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

Free Support Forum - aspose.com

Unable to keep embedded images intact while converting from EML to MSG

Hi,

I want to convert EML file to MSG file. I tried to use examples from this. Code looks like this:

public static void ConvertToMsg(string fileName)
{
var message = Aspose.Email.Mail.MailMessage.Load(fileName);
message.Save(@“E:\TempUploadFolder\TestMsg.msg”,MailMessageSaveType.OutlookMessageFormatUnicode);
message.Dispose();
}

I was able to convert the email file but images inside body (embedded images) were replaced with unknown link.

I have attached both EML and MSG files.

Hi Jason,


Thank you for writing to Aspose support team.

Could you please share with us which version of Aspose.Email for .NET you are using at your end and if you have properly initialized the license in your application? I have converted your sample EML file to MSG format using the latest version of Aspose.Email for .NET 4.0.0 and it is converted fine as you can see in the attached screenshot. Also, I have attached the converted MSG file for your reference here. Please give it a try at your end and let us know your feedback.


I have initialized license (I no longer get “This is evaluation copy” message in header) using embedded resource method and following code:
private void InitializeAsposeLicense()
{
using (Trace.Main.scope())
{
try
{
var license = new License();
license.SetLicense(
@“Aspose.Email.lic”);
}
catch (Exception ex)
{
Trace.Main.exception(ex);
}
}
}

Aspose.Email version info:



I am using .net 4.0 version.

Did you use the same code I pasted above?

I tried with very simple code without success:

namespace Aspose.Mail.EmbeddedImages
{
internal class Program
{
private static void Main(string[] args)
{

const string dataDir =
@“C:\Users\user\Desktop\ConvertToMsg”;

#region Converting EML to MSG keeping MSG intact

var message = MailMessage.Load(dataDir + @“test.eml”);
message.Save(dataDir + @“test.msg”, MailMessageSaveType.OutlookMessageFormatUnicode);
message.Dispose();

#endregion
}
}
}

Just updated Aspose.Email to 4.0 version and EML to MSG conversion start working properly.

Very important upgrade, I will say.

Hi Jason,


Thank you for providing feedback and it is nice to know that your problem is resolved. Please feel free to write us back if you have any other query in this regard.