Free Support Forum - aspose.com

Convert .eml file to .msg

Hello,

Is there a code snippet / example for converting .eml file to .msg format?

Thanks!

Hi,

Thank you for writing to Aspose Support team.

Please use the MailMessge class to load the EML file and save it in various formats such as MSG, MSG Unicode, MHTML, EMLX.

Sample Code:


// Base folder for reading and writing files
string strBaseFolder = “D:\Data\Aspose\resources\”;

// Initialize and Load an existing EML file by specifying the MessageFormat
MailMessage eml = MailMessage.load(strBaseFolder + “AnEmail.eml”);

//Save the Email message to disk in Unicode format
eml.save(strBaseFolder + “AnEmail.msg”, SaveOptions.getDefaultMsgUnicode());


Thank you! That works.

Hi,


You are welcome and please feel free to contact us if you have any other query related to the API.