none
VSTO - AddIn for Office Outlook 2010 - Visual studio 2010 RRS feed

  • Question

  • Hi,

    I have a question for you. I'm delevoping a Outlook addin. I some cases i want to copy the current mailitem and add a subject to the new copy and send the copy. The problem is:

    If the current mailitem have this in body:

    Regarding

    Erkan /DENMARK

    Phone:XXXXXXXX

    Email:XXXXXXXX

    [LOGO]

    Disclaimer

    This message is for a specific indivual bla bla bla.

    The problem is if I use the following code to copy the body from the current mailitem to the copy:

    copytobesent.Display(false);

    copytobesent.BodyFormat = Outlook.OlBodyFormat.olFormatHTML;

    copytobesent.HTMLBody = currentmailItem.HTMLBody;

    Then the [LOGO] doesnt appear in the sended copy mail.

    The problem is that the current mailItem have some autosignature. But the attached images int the body doesnt follow with the sended copy mail. It is linked to a file that doesnt exist.

    Tuesday, March 11, 2014 9:21 AM

Answers

  • Hello Erkan,

    Did you have a chance to check out the resulted HTML markup of your message?

    The fact is that all embedded images should be referenced using a special syntax - <img src="cid:image_name"> where the image_name is a value which you should set the PR_ATTACHMENT_CONTENT_ID to. So, the sid prefix should be used. If you want to embed images into the body, you need to do the following in the code: 

    1. Refer to the image in the HTML body using the cid attribute - <img src="cid:image_name">

    2. Add the attachment using the Add method of the Attachements class (see MailItem.Attachments).

    3. Set the PR_ATTACH_CONTENT_ID property (DASL - http://schemas.microsoft.com/mapi/proptag/0x3712001F) using the PropertyAccessor object returns from the Attachment class. See the SetProperty method of the PropertyAccessor class for details. Note, the value should correspond to the cid value in the HTML markup.


    Tuesday, March 11, 2014 10:17 AM

All replies