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

Free Support Forum - aspose.com

Get email attached to an email

Hi,

Currently we are looking for a .net component who allow us to extract all attachments from an email

.msg We already have find a component BUT this component can't extract email attached in a email,

particulary email attached in an email by a drag and drop in outlook. We want to know if your component can do that ...


It's important to know that this email attached is attached by a drag and drop ...

because if you save an email as msg or other in your disk and add it in an email and send this, I'm pretty sure it works because it is considered like a regular attachment. By drag and drop in outlook, I'm not sure the email attach is considered as attachment.


Thanks for your answer.

Have a nice day

Fred

Hi Fred,


Thank you for contacting Aspose support team.

Aspose.Email can be used to get attached messages from an existing email. When a message is attached with an existing message, the Attachment.ContentType.MediaType is set to “message/rfc822”. You may please give a try to the following sample code which extracts the attached message.

static public void CheckAttachments()
{
MailMessage msg = MailMessage.Load(@“message_2.msg”, MessageFormat.Msg);
Attachment att = msg.Attachments[0];
if (att.ContentType.MediaType == “message/rfc822”)
{
MemoryStream ms = new MemoryStream();
att.Save(ms);
MailMessage attMsg = MailMessage.Load(ms);
attMsg.Save(“AttachmentMsg.msg”, MailMessageSaveType.OutlookMessageFormatUnicode);
}
}