Use Javascript to create an HTML email in Microsoft Outlook

MSG file format is documented, but it is certainly not fun…
Why not create an EML (MIME) file?

The suggestion is to use the EML (MIME) format. According to the OP, they considered the MSG file format (#4), but were discouraged by its complexity and lack of JS libraries that process that format. If MSG file was considered, MIME is a much better choice – it is text based, so no special libraries are required to create it. Outlook will be able to open it just as easily as an MSG file.

To make sure EML message is treated as an unsent message by Outlook, set the X-Unsent MIME header to 1.


The simplest EML file would look like the following:

To: Joe The User <[email protected]>
Subject: Test EML message
X-Unsent: 1
Content-Type: text/html

<html>
<body>
Test message with <b>bold</b> text.
</body>
</html>

Leave a Comment