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

Free Support Forum - aspose.com

MSG with embedded msg's (eml's) cannot get attachments

Hi, I have been testing whether Aspose.Network.Mail can support the parsing of mail messages with multiple tiers of embedded .msg files.

What appears to happen is that when reading an Attachment stream as a .Eml formatted MailMessage the attachments are not parsed.

Is this a bug? I looked at using the MapiMessage.LoadFromProperties route but this does not effectively allow access to a stream to save any changes to the messages.

Is there a. a way of achieving this currently or b. a fix for this?

Many Thanks

Hi,

Thanks for considering Aspose. We are looking into this issue and will get back to you ASAP. Could you post some sample .msg file for our analysis.

Hello,

Aspose.Network provides outlook message files attachment supports. Please check the sample code blow.

Because the attached outlook message is not simple binary format data like other files. The outlook file is embeded as object data.

MapiMessage outlook = MapiMessage.FromFile(path);//load the outter message file
foreach (MapiAttachment att in outlook.Attachments)//check attachments
{

//if object data is not null and the object data is outlook message
if (att.ObjectData != null && att.ObjectData.IsOutlookMessage)
{

//load the properties from object data.
MapiMessage attch = MapiMessage.FromProperties(att.ObjectData.Properties);
}
}

I am having similar issues with this functionality. There is another thread (222993) that is similar too. This is what I have observed:



I have a MSG file with a structure similar to this:



My.msg

+ BaseEmail

–+ MyAttachedEmail (embedded)

----+ AnAttachedFile.doc



Using the provided code above, the attch variable will contain the MyAttachedEmail attachment, but its Attachments collection is empty.



If however, I use code like the following, the attachment AnAttachedFile.doc is available in the Attachments collection:



Debug.Assert(att.ObjectData != null && att.ObjectData.IsOutlookMessage);

var tempPath = FileUtils.GetTempFileName(".msg");

att.Save(tempPath);

var embeddedMsg = MapiMessage.FromFile(tempPath);

File.Delete(tempPath);

:



However if I do the later, it seems like some essential properties such as MessageClass are missing.





Ideally I would like to avoid saving the embedded email to disk like this. Is this possible?

Hi Phil,


Please create a new thread and provide us your sample file, so we may look into this problem for you.

Thanks and Regards,