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

Free Support Forum - aspose.com

MailMessage.Save(.msg File) marks the message as sent message

Hi,

I am using MailMessage Save metthod to create new message and save message as .msg file so I can open that mail (.msg file) in outlook later on. But on saving it marks mail as sent mail by setting sent datetime with the datetime I saved the file on system. My Problem with this is that mail is no more new mail and don't have send button on it and it has reply/reply all / forward buttons. I need to do some processing after email is send but I can't send this message now.

Please let me know how can I fix this,

Regards

Qasim Javed

For future reference

Found an Answer in other Post by setting Mapimessage SetMessageFlag(MapiMessageFlags.MSGFLAG_UNSENT)

Following is the example code

// change properties of an existing msg file

string strExistingMsg = @"E:\Data\Aspose\temp\ptcl.msg";

// load the existing file in MailMessage

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

// change the properties

msg.Subject += "NEW SUBJECT (updated by Aspose.Network)";

msg.HtmlBody += "NEW BODY (udpated by Aspose.Network)";

// create instance of type MapiMessage from MailMessage

MapiMessage mapiMsg = MapiMessage.FromMailMessage(msg);

// set message flag to un-sent (draft status)

mapiMsg.SetMessageFlags(MapiMessageFlags.MSGFLAG_UNSENT);

// save it

mapiMsg.Save(strExistingMsg);