I want to send a Mail
via Outlook
and C#
but I have a problem with the placement of my Attachments
. I have the following code:
if (strBody.StartsWith(@"{\rtf"))
{
mailItem.BodyFormat = Microsoft.Office.Interop.Outlook.OlBodyFormat.olFormatRichText;
mailItem.RTFBody = Encoding.UTF8.GetBytes(strBody);
mailItem.Attachments.Add(strAttachment, Microsoft.Office.Interop.Outlook.OlAttachmentType.olByValue, int.MaxValue, null);
}
else
{
mailItem.Body = strBody;
mailItem.Attachments.Add(strAttachment, Microsoft.Office.Interop.Outlook.OlAttachmentType.olByValue, 1, null);
}
My strBody has the following Value:
{\rtf1\ansi\ansicpg1252\deff0\deflang1031{\fonttbl{\f0\fnil\fcharset0 Arial;}} {\colortbl ;\red255\green0\blue128;\red0\green128\blue255;} \viewkind4\uc1\pard\fs20 Sehr geehrte \cf1 Damen\cf0 und \cf2 Herren\cf0 ,\par \par hier ihre AB\fs20\par }
But my Mail
looks like this:
Now my Question is,
- Can the
Attachments
be displayed as an extra Row like when the Mail is not RTF formatted? - If not 1., then how can I get my
Attachments
to be displayed at the End?