Last active
November 1, 2025 07:49
-
-
Save aspose-com-kb/8ded94f3929ac5f17a12f226fc922487 to your computer and use it in GitHub Desktop.
Convert EML to JPG in C#. For details: https://kb.aspose.com/email/net/convert-eml-to-jpg-in-csharp/
This file contains hidden or 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
| // Initialize an object of the EmlLoadOptions class. | |
| Aspose.Email.EmlLoadOptions EmlLoadOptions = new Aspose.Email.EmlLoadOptions(); | |
| // Call the Load method of the MailMessage class to load the source eml file. | |
| Aspose.Email.MailMessage Mailmsg = Aspose.Email.MailMessage.Load("input.eml", EmlLoadOptions); | |
| // Create an instance of the MemoryStream class. | |
| MemoryStream msgStream = new MemoryStream(); | |
| // Call the Save method to convert EML to MHTML and save to stream. | |
| Mailmsg.Save(msgStream, Aspose.Email.SaveOptions.DefaultMhtml); | |
| // Access the Position property and set the current position within the stream. | |
| msgStream.Position = 0; | |
| // Instantiate an instance of the Document class with the MHTML stream. | |
| Aspose.Words.Document msgDocument = new Aspose.Words.Document(msgStream); | |
| // Save the document as JPG image by calling the Save method. | |
| msgDocument.Save("output.jpg", Aspose.Words.SaveFormat.Jpeg); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment