An EML is a file extension for an e-mail message saved to a file in the MIME RFC 822 standard format supported by Outlook, Outlook Express, Windows Live Mail, or Thunderbird. Furthermore, the EML file format is a plaintext MIME (rfc822) file format for storing emails. On the other end, MSG is a compound file binary format based on Microsoft’s Outlook MAPI. Also, the Outlook Item MSG (. msg) file format is a syntax for storing a single Message object, such as an email, an appointment, a contact, a task, and so on, in a file.

So in this article, we are going to discuss the steps on how to programmatically convert EML files to MSG format using REST API.

Email Processing API

Aspose.Email Cloud is a REST-based API offering the capabilities to create, manipulate and render common email formats (Outlook EML, MSG, iCalendar files, and VCard) to other supported file formats. You get the capabilities to work with Header, Sender Address, Content included in the message, or process email’s attachments like files, photos, documents, and much more. At the same time, implement contact cards processing (Operate VCard) or process Calendar through iCalendar Support in your applications.

In order to facilitate the developers, we have created wrappers around Cloud APIs, so that you get all the features right within your favorite IDE. Before proceeding further, we recommend visiting the following link to learn more about how to install Aspose.Cloud SDKs.

Convert EML to MSG in C#

Please follow the steps given below to accomplish your requirement:

  • Firstly, create an object of EmailCloud class by passing ClientID and Client Secret details as arguments
  • Secondly, read source email file to File.OpenRead instance and upload to cloud storage UploadFile(…) method
  • Thirdly, create an instance of EmailGetAsFileRequest passing input file and resultant format
  • Now use EmailGetAsFile API to convert EML file available in Cloud storage to MSG format
  • Finally, call custom method to save resultant file to local drive using File.Create instance

The sample files used in the above example can be downloaded from sample.eml and converted.msg.

In case you need to load the file from the local drive and perform the conversion, please try using EmailConvert API.

EML to MSG using cURL Command

As Aspose.Email Cloud is developed according to REST architecture, so it can easily be accessed via cURL commands. Use the terminal application/command prompt to access the APIs. So the first step is to generate a JWT access token based on client credentials specified over Aspose.Cloud dashboard. For further details, please visit How to Obtain JWT token using a Client ID and Client Secret key.

Once we have the JWT token, please use the following command to convert the EML file available in Cloud storage to MSG format and save the output on the local drive. For conversion purposes, EmailGetAsFile API is used.

curl -X GET "https://api.aspose.cloud/v4.0/email/as-file?fileName=sample.eml&format=Msg" \
-H  "accept: multipart/form-data" \
-H  "authorization: Bearer <JWT Token>" \
-o Converted.msg


In this article, we have discussed the capabilities of Aspose.Email Cloud for processing popular email formats. Specifically, we have discussed the conversion of the EML file to MSG using the C# .NET and cURL command. Nevertheless, the Cloud SDKs are developed as per the MIT license and you can download the complete source code is available over GitHub.

We have also provided a swagger view of Cloud APIs so that you can test the APIs within a web browser. Furthermore, if you encounter any issues or you have any further queries, please feel free to contact us through the free customer support forum.