You're overwriting what's there already. Either concatenate your text to
the existing HTMLBody or concatenate the existing HTMLBody to your text.
news:EedOg.921$vJ2.799@newssvr12.news.prodigy.com. ..
Quote:
>>I am trying to send emails from my application (not using a plugin, that
>>will come later), I can create an email and add attachments. I can fill in
>>the body etc. Word works for the editor. So mostly what I want.
>My issue is I would like to retain the signature block that exists when I
>insert my body into the message.
>>
>Any help would be appreciated. Here is the code I am using:
>>
>//Initialize the envelope values.
>string strTo = "name@domain.com";
>string strBCC = "name@domain.com";
>string strCC = "name@domain.com";
>string strSubject = "Outlook Automation";
>string strBody = "HTMLPage1.htm";
>>
>//Automate the Word document.
>wApp = new Word.Application();
>wApp.Visible = false;
>object template = System.Reflection.Missing.Value;
>object newTemplate = System.Reflection.Missing.Value;
>object documentType = Word.WdNewDocumentType.wdNewEmailMessage;
>object visible = false;
>wApp.Visible = false;
>Word._Document doc = wApp.Documents.Add(
> ref template,
> ref newTemplate,
> ref documentType,
> ref visible);
>>
>//Automate the Outlook mail item.
>Microsoft.Office.Interop.Outlook.MailItem mItem =
>(Outlook.MailItem)doc.MailEnvelope.Item;
>mItem.To = strTo;
>mItem.BCC = strBCC;
>mItem.CC = strCC;
>mItem.Subject = strSubject;
>>
>// Attach a file
>String sSource = "C:\\TEMP\\org.sql";
>String sDisplayName = "MyFirstAttachment";
>int iPosition = 1;
>int iAttachType = (int)Outlook.OlAttachmentType.olByValue;
>Outlook.Attachment oAttach = mItem.Attachments.Add(sSource, iAttachType,
>iPosition, sDisplayName);
>>
>// Set the body
>// Comment out and the signature stays
>mItem.BodyFormat = Outlook.OlBodyFormat.olFormatHTML;
>mItem.HTMLBody =
> "<html><head><title></title></head>"
> +"<body><p>This is a text from my application</p>"
> +"<br /><b>Some bold stuff</b>"
> +"<br /></body></html>";
>>
>wApp.Visible = true;
>>
>// Loop until there are no more references to release.
>while (Marshal.ReleaseComObject(mItem) 0) ;
>mItem = null;
>>
>// Invoke the .NET garbage collector.
>GC.Collect();
>GC.WaitForPendingFinalizers();
>>
>>