Eml to msg convertion with embeded message


#1

Hi,

I am converting and rfc822 eml to msg as per the documentation. If the eml has an embeded message the resulting msg seems not to convert the embeded message leving it as an eml?

Do you need to recurse through the embeded messages and convert each one ?

Thanks

Marcus


#2

Hi Marcus,

Thanks for considering Aspose.

Could you please post a sample eml file here for our testing? We will look into it.


#3

Have attached the eml.

We are using 4.8 with th trail licence, as you wil see it does not convert the embeded email as well.

Thanks


#4

Hi,

During eml to msg conversion, it does not change the format of any embedded or attached files. The embedded/attached files from eml file appear as embedded attachments in the msg file.

Embedded eml files need to converted manually and added to the converted msg. Below would be the sample code snippet that also converts nested eml attachments to msg.


// load eml file

string strEml = @“E:\Data\Aspose\temp\4439927-11960.eml”;

//string strEml = @“E:\Data\Aspose\temp\mail.eml”;

string strMsg = @“E:\Data\Aspose\temp<span class=“kwrd”>out.msg”;

MailMessage eml = MailMessage.Load(strEml, MessageFormat.Eml);


// save to msg file

eml.Save(strMsg, MailMessageSaveType.OutlookMessageFormat);


MemoryStream stream = null;


// array to save the eml attachments in Attachment collection

Attachment[] arrEmlAtt = new Attachment[eml.Attachments.Count];

int i = 0;


// convert all eml attachments to msg

MailMessage msg = MailMessage.Load(strMsg, MessageFormat.Msg);

foreach(Attachment att in eml.Attachments)

{

// loop through all the attachments

int index = att.Name.LastIndexOf(’.’);

if (att.Name.Substring(index, 4) == “.eml”)

{

// save attachment to stream

stream = new MemoryStream();

att.Save(stream);

// load in MailMessage

stream.Position = 0;

MailMessage emlAtt = MailMessage.Load(stream, MessageFormat.Eml);

stream = new MemoryStream();

// convert to msg

emlAtt.Save(stream, MailMessageSaveType.OutlookMessageFormat);

// add as an attachment of main msg

stream.Position = 0;

msg.Attachments.Add(new Attachment(stream, att.Name + “.msg”));

}

}


// get all the attachments of eml format from the msg file

foreach (Attachment att in msg.Attachments)

{

int index = att.Name.LastIndexOf(’.’);

if (att.Name.Substring(index, 4) == “.eml”)

{

arrEmlAtt[i] = att;

// eml attachment counter

i++;

}

}


// delete eml attachments from msg file

for (int emlIndex = 0; emlIndex < i; emlIndex++)

{

msg.Attachments.Remove(arrEmlAtt[emlIndex]);

}


// save the main msg

msg.Save(strMsg, MailMessageSaveType.OutlookMessageFormat);


#5

Thanks for this I though that it would do it by default, probally something you should add into the product as alot of your cutomers are probally using it for converstion.

Is there any way to get Aspose not to see embedded messages not as purely file attachments?


What I want is can i get Apsose to convert EML to MSG but get the embedded messages to behave like normal embedded messages in MSGs. As it seem that Aspose convert the embed emls as pure attachments, ok these can be converted to MSG and reattached but as an attachment and not as an embedded message. On opening the resulting msg in outlook it complains that the (embedded msg)attachment may be potentially dangerous etc. this is not a good user experiance as you may agree.

This is holding us back at the moment buying an OEM liceence.

Marcus


#6

Hi Marcus,

Thanks for your valuable suggestions.

Regarding the automatic conversion of eml attachments to msg, I have put this suggestion to the development team and they will consider adding this in future. I have also added it in our issue tracking system (ID: 13471).

For other issue, where attachments appear in the body of the msg file (instead regular attachments) after conversion, we will look into it too. Issue ID is 10521.

I will update you about the status of these issues as soon as we fix these. Sorry for the inconvenience.


#7

The issues you have found earlier (filed as 13471) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

#8

The issues you have found earlier (filed as 14159;10521) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(1)