Attach msg as an item and sending the message to gmail and not using Exchange SMTP Server.
Then the message is not readable. The gmail only see Winmail.dat.
But in the same copy that go to email exchange email is ok.
Below is the code
<%@ Import namespace=“Aspose.Email” %>
<%@ Import namespace=“Aspose.Email.Mapi” %>
<%@ Import namespace=“Aspose.Email.Clients.Smtp” %>
<%@ Import namespace=“System.IO” %>
<%
Dim eMailLicense As New Aspose.eMail.License()
eMailLicense.SetLicense("Aspose.Email.lic")
Dim vDataDir as String = “D:\Website\TestAspose”
Dim MailMsg as MailMessage = new MailMessage()
MailMsg.From = “xxxxx@abc.com.au”
MailMsg.To = “xxxyyy2000@gmail.com”
MailMsg.Subject = “This is test message”
MailMsg.Body = “This is test body”
MailMsg.HtmlBody = “This is test body”
Dim msg as MapiMessage
msg = MapiMessage.FromMailMessage(MailMsg)
Dim attachMsg as MapiMessage = MapiMessage.FromFile(vDataDir & “test.msg”)
msg.Attachments.Add(“test1.msg”, attachMsg)
Dim attachFaxMsg as MapiMessage = MapiMessage.FromFile(vDataDir & “testFax.msg”)
msg.Attachments.Add(“test2.msg”, attachFaxMsg)
'msg.Save(vdataDir + “testWithMsg.msg”)
'Dim Stream As MemoryStream = New System.IO.MemoryStream()
'msg.Save(Stream)
Dim options as new MailConversionOptions()
options.ConvertAsTnef = true
Dim Message as MailMessage = msg.ToMailMessage(options)
Dim smtp as new SmtpClient()
smtp.Host = “192.168.0.37” ’ Local IIS smtp server, This smtp will cause sending to gmail with msg as attachment and make gmail is not readable
'smtp.host = “smtp.coverforce.com.au” ’ Exchange SMTP server , Send by Exchange smtp then it is OK. We use the latest aspose email net ver 20.11
smtp.Send(Message)
%>