Search code examples
outlookms-wordmhtmlwebarchive

Images in MHT files from MS Word do not display in email


When I email myself sample mhtml files (e.g. from here) images display fine in Outlook. However, when I convert a Word document to mht (Web Archive) format, the images do not display. If I open the file in a browser, the images display fine, or if I attach the mht file and double click on the attachment. But if the file is inlined in the email, then I get the red X box with 'Right click here to download pictures', and if I select download pictures, then 'file can not be displayed...may have moved...'.

Any ideas why images in Word docs converted to MHTML do not like to display inline in emails?


Solution

  • An MHTML document is a multi-part MIME document. The first part of the document is HTML and has links to the images in the other parts. The problem is that the links don't work in an inline email even though they do work in a browser. Looking at some examples, you can see the links must be prefixed by "cid:", and the part after the "cid:" must have a Content-ID in the header of the corresponding MIME part.

    The link can be as simple as "cid:image002.gif" with the Content-ID in the corresponding MIME part being:

    Content-ID: <image002.gif>
    

    If all of the links are fixed in this way, the html with the images will display inline in Outlook.