Hello,
we are trying to make email message with body from docx. According to the article that should be easy, but when I implemented the same I discovered that html was added to email message as an attachment. But we need docx content to be as email body. I see that your library do this in a very good way here - https://products.aspose.app/email/conversion and I tried this I received expected results. So, now the question how can we do this from the code?
Here is my code:
Document wordDocument = new Document(“Word.docx”);
MemoryStream mhtmlStream = new MemoryStream();
wordDocument.Save(mhtmlStream, SaveFormat.Mhtml);
mhtmlStream.Position = 0;
MailMessage message = MailMessage.Load(mhtmlStream, new MhtmlLoadOptions());
message.Headers.Add(“X-Unsent”, “1”);
message.Subject = “Sending Invoice in Email”;
message.From = “from@gmail.com”;
message.To = “to@gmail.com”;
message.Save(“Email.eml”, SaveOptions.DefaultEml);
And the EML message I receive in attach.Email.zip (18.4 KB)