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

Free Support Forum - aspose.com

Saving html .oft as .msg

Hi, I am evaluating Aspose.Email.

We need to be able to take an .oft (html) file, edit it,save it as a .msg and open it with Outlook.
I found sample code to do just that, which I used as basis for my test (see below).
The test opens the .oft and creates a .msg.

However, when the .msg is opened in Outlook it is loaded as a text msg (not html).
What am I doing wrong?

Dev env: VS 2010, .net v4
OS Windows: 8.1
Outlook 2010 (v 14.07.7116.5000)

I have attached an archive containing the source .oft and the generated .msg file.
It also includes a .msg (t1_outlook.msg) which was created from the .oft file using Outlook.

test code:
static void MsgFromOft(string data_dir_, string fn_)
{
var oft1_fn = fn_ + “.oft”;
var oft1_path = Path.Combine(data_dir_, oft1_fn);
var msg_fn = fn_ + “.msg”;
var msg_path = Path.Combine(data_dir_, msg_fn);

var msg = MailMessage.Load(oft1_path, MailMessageLoadOptions.DefaultMsg);
//var msg = MailMessage.Load(oft1_path, MessageFormat.Msg);

msg.To.Add(new MailAddress(“kon@mymail.net.au”, “Kon”));

var outlookMsg = MapiMessage.FromMailMessage(msg);
outlookMsg.SetMessageFlags(MapiMessageFlags.MSGFLAG_UNSENT);
outlookMsg.Save(msg_path);
System.Diagnostics.Process.Start(msg_path);
}

Hi Kon,


Thank you for contacting Aspose support team.

I have tested the scenario and would like to share that your code is ok and there is no problem with it, however due to some regression issue, the html formatting is lost in the resultant MSG file. I have logged this issue in our issue tracking system under id: NETWORKNET-34357 for further investigation by our development team. Once there is any information available in this regard, we’ll update you here via this thread here.

However for the time being you may please use following workaround to achieve the functionality:

MapiMessage mapi = MapiMessage.FromFile(@“D:\Aspose\DataOftToMsg\t1.oft”);
mapi.Recipients.Add(“kon@mymail.net.au”, “Kon”, MapiRecipientType.MAPI_TO);
mapi.SetMessageFlags(MapiMessageFlags.MSGFLAG_UNSENT);
mapi.Save(@“D:\Aspose\DataOftToMsg\Resultant.msg”);
We are sorry for the inconvenience caused to you and please feel free to write us back if you have any other query in this regard.

Hi,
thanks for the info. Your work around works.

I am very interested to see how quickly the issue is fixed.

Hi Kon,


We’ll update you here via this thread once there is an update available in this regard.

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


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Thanks, the update has fixed the issue.

Hi Kon,

We are glad to know that your issue is resolved. Please feel free to write us back if you have any other query related to Aspose.Email.