Free Support Forum - aspose.com

How to load embedded message

Hi all,

Happy new year

I have an eml file which has a .msg / rfc822 message as an attachment.

I am able to load the eml file and can see the attachment has IsEmbeddedMessage true. I want to load this embedded message as a new message and read the header values

Any pointers how can i load the attachment as a new MailMessage in .net?

I am not a developer by any means, just trying to put a quick and dirty proof of concept together

thanks a lot – Varun

@varunagg

I suggest you to please visit the following thread link for your kind reference.

Thanks Mudassir, i am not able to open the link it says Oops! That page is private.

Are you able to open the link ?

@varunagg

Can you please try again on your end.

Thanks Mudassir. I can read the post now.

I am using version 20.12

Here is the snippet of code in Powershell

Add-type “C:\aspose.email.20.12.0\lib\net35\Aspose.Email.dll”
$FileToLoad = “c:\test\file1.eml”

$LoadOptions = new-object Aspose.Email.EmlLoadOptions
$LoadOptions.PreserveEmbeddedMessageFormat = $true

$objMailmsg = [Aspose.Email.MailMessage]::Load($FileToLoad, $LoadOptions)
$objMailmsg.Attachments[0].Save(“c:\varun\ra\Aspose.Save1.msg”)

The message is saved but cannot be opened in outlook

@varunagg

Can you please share the source EML file along with generated MSG file that fails to open. Please share the requested information so that I may investigate issue on my end.