Convert EML and MSG Emails to PDF using C#

Convert Email to PDF

There could be various scenarios when you need to embed the content of the emails within your web or desktop applications. In such cases, you can convert the email messages into a format that can easily be embedded and displayed. One of the possible solutions is email to PDF conversion. This article provides a step-by-step guide and code sample of how to convert an EML or MSG email to PDF using C#.

C# EML and MSG Emails to PDF Converter API

Aspose.Email for .NET is a C# class library that is designed to create and manipulate popular email formats from within the .NET applications. In combination with Aspose.Words for .NET, the API lets you convert the email messages to PDF format with high fidelity. You can either download the APIs’ DLLs or install them within your .NET applications using NuGet.

PM> Install-Package Aspose.Words
PM> Install-Package Aspose.Email

Steps to Convert EML or MSG to PDF using C#

The following are the steps to convert email messages to PDF format in C#.

  • Save the email message into a MemoryStream object as default MHTML format.

C# Email to PDF Conversion – Complete Code

The following is the complete code to convert an email message to PDF using Aspose.Emails for .NET and Aspose.Words for .NET APIs.

Get a Free License

You can get a free temporary license in order to try the APIs without evaluation limitations.

Live Demo

Conclusion

Email to PDF conversion may come into practice when you need to embed the email messages within your web or desktop applications. Therefore, in this article, you have learned how to convert email messages to PDF using C# within your .NET applications. In order to explore more about the APIs being used, you can visit the following documentations.

See Also