Converting Outlook Message File (MSG) to TIFF Image

Contents
[ ]

In this article, we show you how to convert an Outlook MSG file to a TIFF image.

  1. First, read an MSG file and convert it to MHTML format with Aspose.Email for .NET. Use the Aspose.Email.MailMessage class to load the message file.
  2. After loading the file, call the MailMessage.Save() method and save it to stream in MHTML format.
  3. Use Aspose.Words for .NET to convert the MHTML stream to TIFF. Use the Aspose.Words.Document class to load the MHTML stream.
  4. Finally, call the Document.Save() method to save the MHTML document to TIFF.

If the document contains multiple pages a multi-page TIFF file is generated. The code snippets below show how to convert Outlook Message File (MSG) to TIFF Image.

// For complete examples and data files, please go to https://github.com/aspose-email/Aspose.Email-for-.NET
// The path to the File directory and load the MSG file using Aspose.Email for .NET
string dataDir = RunExamples.GetDataDir_KnowledgeBase();
MailMessage msg = MailMessage.Load(dataDir + "message3.msg", new MsgLoadOptions());
// Convert MSG to MHTML and save to stream
MemoryStream msgStream = new MemoryStream();
msg.Save(msgStream, SaveOptions.DefaultMhtml);
msgStream.Position = 0;
// Load the MHTML stream using Aspose.Words for .NET and Save the document as TIFF image
Document msgDocument = new Document(msgStream);
msgDocument.Save(dataDir + "Outlook-Aspose_out.tif", SaveFormat.Tiff);