We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Mails within Mails

When I connect up to Exchange 2010 using IMAP to download mails, I am getting a mail back, but the entire mail is sitting as an attachment within the mail. The mail body will be the same format for every mail with just the Sender, Subject, Messade-OD and Recipient.

This was not happeing when testing against 2007. I have been through the IMAP transport protocol in Exchange, and changed to all of the different message formats, right down to Text, and restarted IMAP, but this is still happening.

How do I get it that the message gotten is actually the message, and I don't now have to start playing around with it to check if there is an attachment ect.

Hi,


Please accept my apologies for delayed response on this.

I am trying to understand the issue that you are having and I think it is related to the embedded emails. For a note, there are certain messages that contain another email (s) as attachments. You can extract such emails emails using the Attachment.Save method.

To understand your issue better, can you please elaborate further with snapshots or/and sample message file for our review.

We are sorry for your inconvenience.

Hi Babar,

Here is a file that came from this. Hope this helps.

Regards

Robert

Hi Robert,


Thank you for sharing your sample file.

This is an example of embedded emails. You can extract such embedded messages from email in a verity of ways depending upon the nature of your requirement. The simplest and easiest way is to load the message into an instance of MailMessage class and extract the embedded emails as given in below source code.

C#

var message = Aspose.Email.Mail.MailMessage.Load(“748.msg”);
var attachments = message.Attachments;
foreach (var attachment in attachments)
{
var extension = Path.GetExtension(attachment.Name);
if (extension.ToLower() == “.eml” || extension.ToLower() == “.msg”)
{
attachment.Save(attachment.Name.Replace(":", “”));
}
}