I\'m trying to use a Microsoft Word document as the body to an Microsoft Outlook email. So far I have been able to include the text from a Word .docx into the body of the em
First of all, you are setting the plain text MailItem.Body
property.
Secondly, create an attachment and set the PR_ATTACH_CONTENT_ID
property (DASL name "http://schemas.microsoft.com/mapi/proptag/0x3712001F"
) using Attachment.PropertyAccessor.SetProperty
.
Your HTML body (MailItem.HTMLBody
property) would then need to reference that image attachment through the cid attribute:
<img src="cid:xyz">
where xyz is the value of the PR_ATTACH_CONTENT_ID
property.
Look at an existing message with OutlookSpy (click IMessage button).
EDIT: sample script (off the top of my head):
attachment = MailItem.Attachments.Add("c:\temp\MyPicture.jpg")
attachment.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001F", "MyId1")
MailItem.HTMLBody = "<html><body>Test image <img src=""cid:MyId1""></body></html>"