I have just downloaded the latest version of ASPOSE.Network and I keep getting an error at the line shown in red when I try to run the MIME sample in VB.Net. We are currently in the process of evaluating your library to explore the possibility of extarct embedded attachments from Outlook MSG files
I’ve tested the file you sent me. It seems normal here. By the way, the file you sent me is an EML file, not a MSG file. could you please try the following code samples?
Aspose.Network.Mime.MimeMessage msg; msg = Aspose.Network.Mime.MimeMessage.Load(@“d:\download\FW_ This is rich text sample.eml”); //print out msg if (msg.From != null) Console.Write("\n From: " + msg.From.ToString()); if (msg.To != null) Console.Write("\n To: " + msg.To.ToString()); if (msg.Subject != null) Console.Write("\n Subject: " + msg.Subject);
Console.WriteLine("\n Mail body: “); if (msg.TextBody != null) Console.Write(”\n" + msg.TextBody); if (msg.HtmlBody != null) Console.Write("\n" + msg.HtmlBody);
//save all the attachments to file foreach (Aspose.Network.Mail.Attachment attachment in msg.Attachments) { attachment.Save(@“d:” + attachment.Name); } //save the msg as mht page: msg.Save(@“d:\test.mht”, Aspose.Network.Mail.MessageFormat.Mht);
//pause screen Console.Read();
The sample above will print out the mail message information to screen, and save all the attachments.
Dim msg As Aspose.Network.Mime.MimeMessage msg = Aspose.Network.Mime.MimeMessage.Load(“d:\download\FW_ This is rich text sample.eml”) ‘//print out msg If (msg.From IsNot Nothing) Then Console.Write(vbCrLf & "From: “ & msg.From.ToString()) End If If (msg.To IsNot Nothing) Then Console.Write(vbCrLf & ” To: “ & msg.To.ToString()) End If If (msg.Subject IsNot Nothing) Then Console.Write(vbCrLf & ” Subject: “ & msg.Subject) End If
Console.WriteLine(vbCrLf & ” Mail body: ")
If (msg.TextBody IsNot Nothing) Then Console.Write(vbCrLf & msg.TextBody) End If If (msg.HtmlBody IsNot Nothing) Then Console.Write(vbCrLf + msg.HtmlBody) End If
’//save all the attachments to file For Each attachment As Aspose.Network.Mail.Attachment In msg.Attachments attachment.Save("d:" & attachment.Name) Next '//save the msg as mht page: msg.Save(“d:\test.mht”, Aspose.Network.Mail.MessageFormat.Mht)