Free Support Forum - aspose.com

Attachments becoming part of the mail

I have an app that takes Msg files and prints the pages to PNG. I was never able to get this working directly in Aspose.Email, so have had to convert the E-Mail to word, and then use Aspose.Word to create the images. This works fine. Except, for some reason or other, in some mails it includes the attached pictures as part of the E-Mail body. If you check the E-Mail, the pictures are not embedded in the E-Mail, so there should be no reason for them to be included in the mail. Here is the code that I use to do the conversion:

Dim msg As Aspose.Email.MailMessage
Dim LoadOptions As New Aspose.Email.MsgLoadOptions()
msg = Aspose.Email.MailMessage.Load(“MSG.MSG”)

Dim msgStream As New System.IO.MemoryStream()
msg.Save(msgStream, Aspose.Email.SaveOptions.DefaultMhtml)
msgStream.Position = 0

Dim WordLoadOptions As New Aspose.Words.LoadOptions
WordLoadOptions.LoadFormat = Aspose.Words.LoadFormat.Mhtml

Dim msgDocument As Aspose.Words.Document
msgDocument = New Aspose.Words.Document(msgStream, WordLoadOptions)

Dim pngFilename As String
Dim Wordoptions As Aspose.Words.Saving.ImageSaveOptions = New Aspose.Words.Saving.ImageSaveOptions(Aspose.Words.SaveFormat.Png)
Wordoptions.ImageColorMode = Aspose.Words.Saving.ImageColorMode.None
Wordoptions.ColorMode = Aspose.Words.Saving.ColorMode.Normal
For a = 0 To msgDocument.PageCount - 1
If a < msgDocument.PageCount Then
Wordoptions.PageIndex = a
pngFilename = “C:\Temp” & a + 1 & “.png”
msgDocument.Save(pngFilename, Wordoptions)
End If
Next

Can you let me know what I can do to sort this out? If I can do this directly within Aspose.EMail, then fine. Else how do I tell Apose.EMail not to include the images when converting to MHTML?

@runrobert,

I have observed your requirements and request you to please try using latest Aspose.Email for .NET 20.2 and Aspose.Words for .NET 20.3 on your end. In case there is still an issue then please share the source file and generated output with us for further investigation.

I have tested verions 20.3, and it works fine. So I am guessing that my only solution on this is to purchase an upgrade? Seems the subscription ended August last year.

@runrobert,

Good to know that your issue is resolved by trying the newer versions of the products.

Yes, your understanding is correct. We cannot evaluate issues using older versions. Neither we include fixes in the older APIs. The fixes are based on latest APIs set only.