Free Support Forum -

Corrupted attachment in MSG

We save PDF attachments in an MSG message using

Dim message As MailMessage

message = MailMessage.Load(TempFilename, MessageFormat.Msg)

Dim MsgFS As FileStream = New FileStream(MsgTempFileName, FileMode.CreateNew, FileAccess.Write, FileShare.Write)


However, Acrobat Reader refuses to read the saved PDF file. Error mesage mentions an incorrect decoding of an email attachment.

Please advise

Just to test a workaround, we changed to:

Dim MapiMsg As Aspose.Network.Outlook.MapiMessage = Aspose.Network.Outlook.MapiMessage.FromFile(TempFilename)


And we still have (corrupted) improperly decoded PDF files.

Please advise

Hi Manuel,

Could you please send us the sample msg file for which this error is occurring. And please also mention the OS, .net version and Aspose.Network version that you are using.

I just tested the attached msg file and saved the pdf attachment without any trouble. The code I used is given below:

Dim msg1 As Aspose.Network.Outlook.MapiMessage = Aspose.Network.Outlook.MapiMessage.FromFile("d:\temp\test1.msg")

For Each att As MapiAttachment In msg1.Attachments

att.Save("d:\temp\" & att.LongFileName)

Next att