Converting Outlook Message File (MSG) to TIFF Image
Contents
[
Hide
]
In this article, we show you how to convert an Outlook MSG file to a TIFF image.
- 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.
- After loading the file, call the MailMessage.Save() method and save it to stream in MHTML format.
- Use Aspose.Words for .NET to convert the MHTML stream to TIFF. Use the Aspose.Words.Document class to load the MHTML stream.
- 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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |