Hi,
Hi Robert,
MapiMessage mapiMsg = MapiMessage.FromFile(“some msg file.msg”);
MailMessageInterpretor mi = MailMessageInterpretorFactory.Instance.GetIntepretor(mapiMsg.MessageClass);
MailMessage mailMsg = mi.Interpret(mapiMsg);
mailMsg.Save(“save as EML.eml”);
This Code is not working in java.18.9.4 email
Thank you for contacting Aspose Support.
Please use the code snippet given below to convert MSG to EML.
MapiMessage mapiMsg = MapiMessage.fromFile("Email.msg");
mapiMsg.save("Email.eml", EmlSaveOptions.getDefaultEml());
We hope that this resolved the issue that you were facing. Please feel free to reach us if additional information is required.
Hello @muhammadahmad,
The above code snippet works good, but I just want to convert MapiMessage to MailMessage, not to save it. I intend to use all the methods provided in the MailMessage as I’m also working with other systems. Do I have to save the MapiMessage (as shown above) and load it again to get MailMessage?
I’m working with PST’s and I could only get MapiMessage out of pst using extractMessage method. I need MailMessage to get what I want from the email.
@VenkateshDharavath,
Welcome to our community! Thank you for posting the query. You can convert MapiMessage
to MailMessage
without saving it to a file as shown below:
MailConversionOptions options = new MailConversionOptions();
MailMessage mailMessage = mapiMessage.toMailMessage(options);
More examples: Loading and Saving Message
API Reference: MailMessage class, MapiMessage class, MailConversionOptions class