mItem.HTMLBody = mItem.HTMLBody & whatever
You're overwriting what's there already. Either concatenate your text to the
existing HTMLBody or concatenate the existing HTMLBody to your text.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
"Jeff" <(E-Mail Removed)> wrote in message
news:EedOg.921$(E-Mail Removed)...
>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 = "(E-Mail Removed)";
> string strBCC = "(E-Mail Removed)";
> string strCC = "(E-Mail Removed)";
> 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();
>
>