We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Loading and converting tnef and non tnef messages


We are having complex logic, in which there is a need of having both .msg and .eml files, with tnef messages interchangably.

Can you please provide code snippits for below loadings and conversion so that the message will not change much.

Source data format .EML (byte[])
Message Construct as EML
Type: Tnef
1).Load .EML with preserving Tnef as (f1.eml)
2).Load .EML without preserving Tnef (f2.eml)
Message Convert as MSG
3).Convert (f1.eml) to .MSG with preserving Tnef
4).Convert (f1.eml) to .MSG without preserving Tnef
5).Convert (f2.eml) to .MSG with preserving Tnef
6).Convert (f2.eml) to .MSG without preserving Tnef

Source data format .MSG (byte[])
Message Construct as MSG
Type: Tnef
7).Load .EML with preserving Tnef as (f3.eml)
8).Load .EML without preserving Tnef (f4.eml)
Message Convert as MSG
9).Convert (f3.eml) to .MSG with preserving Tnef
10).Convert (f3.eml) to .MSG without preserving Tnef
11).Convert (f4.eml) to .MSG with preserving Tnef
12).Convert (f4.eml) to .MSG without preserving Tnef

Thanks in advance.


Could you please share the sample input MSG and expected output EML files here for our reference? We will then provide you more information on it.

In this case, it really doesn’t matter, the main thing is that the input and output values should be as similar as possible.


Please use online conversion to convert EML to MSG and vice versa.

For code, please read the following article.
Convert EML to MSG via C#

I need to implement in my code thus using online converter is not an option

In your documentation there is no concrete documents regarding our inqury

If it is possible can you please provide snippet for loading .msg tnef file, then saving it in .eml


You can use MailMessage.Load to load EML and MSG files and use MailMessage.Save method to save them to EML and MSG file format. For code example and detail, please read following article.
Saving and Converting Messages

If you face any issue, please ZIP and attach your input, problematic and expected output files along with screenshots of issue here for testing. We will investigate the issue and provide you more information on it.

As I said several times in your documentation there is not written in any way how to load tnef messages using MapiMessage, then Convert them to MailMEssage and save them, because inc each step there are a lot of Saving/Loading options thatwe need to pass to methods


Aspose.Email does support of preserving TNEF while loading and saving MSG and EML. You can find the code examples and detail from following article.
Reading Message by Preserving TNEF Attachments