Save email as a msg file in C#

99 Views Asked by At

I can easily create an email using the SMTP Client along with Mail message classes and this gives me a file with a .eml extension. What I want to do is to create a file with a .msg extension. Unfortunately, I don't have outlook, but is it possible in c# to create this file without needing outlook? If so, how?

1

There are 1 best solutions below

0
On

You can use an open-source library like MsgKit to create MSG files without Outlook/MAPI - see https://github.com/Sicos1977/MsgKit.

If you have Outlook (and hence the MAPI system) installed but you prefer not to use OOM or MsgKit for some reason (performance, your code runs in a service, etc), you can use Redemption (I am its author) - it wraps Extended MAPI and would allow you to create standalone MSG files using RDOSession.CreateMessageFromMsgFile and either set properties one at a time or import your existing EML file using RDOMail.Import.