Inline attachments used with EWS and Text, HTML, MHTML or MIME
Exchange Web Services has three different ways to set message body content when working with messages – setting the Text body, setting the html body or creating the message using email MIME (note that there are different types of MIME). Images which are directly with HTML content are not supported. HMTLM is an archival format which does allow images to be imbedded with HTML content, however it is not suited or supported for usage with EWS or any of our messaging APIs for mail creation and it is actually a format only to be used for web page archival.
To add an image with an HTML body, there must be CID tags within the HTML content which refer to images added as attachments. Setting the HTML body and adding attachments are done in separate operations.
Text content is only used for body only content and should not contain any direct inline attachments. Text document messages can only have file attachments. Setting the text body and adding attachments requires multiple operations. EWS can handle this type of content.
HTML content is only used for body only content and should not contain any direct inline attachments. HTML documents need to have a proper CID which correlates directly to an attachment which is added in an independent operation on the message. This is normal for all of our APIs which handle HTML body content. EWS can handle this type of content.
Email formatted MIME content can used by many of our APIs. However, there are different types of MIME content. Our APIs are built to work with properly formatted Email MIME which is formatted per the Exchange Protocol documents. Email Mime can contain message bodies and attachments and can be used in a single operation to create a message with both body parts and attachments. EWS can handle this type of content.
MHTML is both similar and different than HTML and MIME content – it’s a hybrid file format for storing web pages and not geared to usage with any API which does not directly support MHTML creation or ingestion. MHTML is what you get when you try to stuff HTML and everything that HTML from a web page references into a file in with MTHML formatting. This format is not for APIs which are intended to directly work with Email MIME or with HTML. EWS cannot handle this type of content.
https://en.wikipedia.org/wiki/MHTML
Here is an article which covers inline attachments with EWS:
https://msdn.microsoft.com/en-us/library/hh532564(EXCHG.80).aspx
Comments
- Anonymous
March 04, 2012
Hi Daniel, Please I need your help, recently I have started developing an application that reads undelivered email from exchange server 2003 with webdav, the problem is that the undelivered email body are empty but when i see them on the outlook inbox, they have a email body. My question is how to get the email body for the undelivered emails.