Free Support Forum - aspose.com

Missing Body when saving MSG file

I am having an issue when saving an Aspose.Network.Mail.MailMessage as an MSG file. The resulting file has no text in the body and the attached PDF appears in the body of the message.

Here is my workflow:

Dim message As New Aspose.Network.Mail.MailMessage
dim strmFile As IO.FileStream

message.From = New MailAddress("Aspose@Aspose.com")
message.ReplyTo = New MailAddress("Aspose@Aspose.com")
message.To.Add(New MailAddress("Aspose@Aspose.com"))

message.Subject = "Subject"

message.AlternateViews.Add(AlternateView.CreateAlternateViewFromString(“Subject”, Encoding.ASCII, Mime.MediaTypeNames.Text.Plain))

message.AlternateViews.Add(AlternateView.CreateAlternateViewFromString(“Subject”, Encoding.UTF8, Mime.MediaTypes.MediaTypeNames.Text.Html))

strmFile = New IO.FileStream(“C:\MyFile.pdf”, Open, Read, Read)

Dim fileAttach As New Attachment(strmFile, “MyAttachedFile.pdf”)
fileAttach.TransferEncoding = Mine.TransferEncoding.Base64
messageAttachments.Add(fileAttach)

Using strmOut As New IO.FileStream(“MyFile.msg”, OpenOrCreate)
message.Save(strmOut, MessageFormat.Msg)
End Using

Hello Andrew,

We are working at this issue and will back to you ASAP.

Thanks

Do you have a bug tracking number for this issue?

Hi Andrew,

We have logged it in our bug tracking system. The ID is NETWORKNET-10836. We are working on it and will get back to you when its fixed.

Hello,

You can use a workaround for this issue - use the TextBody property and HtmlBody property to set the message body.

For example:

message.TextBody = "Subject"
message.HtmlBody = "Subject"

Thank you. That worked. Is there a way to specify where the attachment will show in the body or specify that the attachment should show in the header?

Hi Andrew,

Currently, the attachments in msg file are shown only in the body of the message. It is a know issue and we are working on this as well.

Is there a way to specify where in the body the attachment will appear? Currently it seems to be inserting before my last
tag.

Hi,

I am sorry, this is also not controllable yet.