Created
July 9, 2024 18:38
Aspose.Words for .NET. Convert file to MHTML using C#.
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-words/Aspose.Words-for-.NET.git. | |
Document doc = new Document(MyDir + "Document.docx"); | |
Stream stream = new MemoryStream(); | |
doc.Save(stream, SaveFormat.Mhtml); | |
// Rewind the stream to the beginning so Aspose.Email can read it. | |
stream.Position = 0; | |
// Create an Aspose.Email MIME email message from the stream. | |
MailMessage message = MailMessage.Load(stream, new MhtmlLoadOptions()); | |
message.From = "your_from@email.com"; | |
message.To = "your_to@email.com"; | |
message.Subject = "Aspose.Words + Aspose.Email MHTML Test Message"; | |
// Send the message using Aspose.Email. | |
SmtpClient client = new SmtpClient(); | |
client.Host = "your_smtp.com"; | |
client.Send(message); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment