How to Convert EML to PNG in JavaScript

EML files are essentially emails that have been saved in file form from applications such as Microsoft Outlook. However, opening these EML files can be a bit of a pain, as they frequently encounter compatibility issues if you don’t have the source application. Due to these compatability issues, converting the file to another format is often the best way to go. In this brief tutorial, we will demonstrate a simple way to automatically convert an EML file to PNG using an API in JavaScript.

To begin, we will run this command to install jQuery:

bower install jquery

Next, we can call the conversion function by inputting the EML file and API key into the following API:

var form = new FormData();
form.append("inputFile", fileInput.files[0], "file");
var settings = {
"url": "",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "multipart/form-data",
"processData": false,
"mimeType": "multipart/form-data",
"contentType": false,
"data": form
$.ajax(settings).done(function (response) {

This will deliver an array of PNG images, one for each page of the EML document. If you need to retrieve an API key, you can do so by registering for a free account on the Cloudmersive website; this provides 800 calls/month across any of our APIs.

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.