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

Free Support Forum - aspose.com

Generate MSG file

Hi,

I read the aritucle in this link:

http://www.aspose.com/documentation/.net-components/aspose.network-for-.net/creatingsaving-outlook-message-msg-files.html

We need to generate an msg file but once is open with outlook we want to send it, the sample code show a outlook screen as it was an email received.

How can i generate an msg file to open with outlook to send it ? ... we do not want to reply or forward, we want to send.

Please advice.

Sincerely,
Yusbel Garcia


This message was posted using Email2Forum by salman.sarfraz.

Hi Yusbel,

Thanks for considering Aspose.

At the end of the same article, there is an example on saving the msg file in draft mode. This example uses an existing msg file. But you can create a new msg file instead. The sample code would be:


// create msg file
string strMsg = @“test.msg”;
MailMessage msg = new MailMessage("from@domain.com", "to@domain.com", “subject”, “body”);

// 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(strMsg);

I figure out after a while. One more thing, after setting an email from the msg file set the from as:

ygarcia@ariad.ca [/o=Ariad Custom Communications/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=yusbel]

Do there is a workaround or i’m missing something here ?


Thanks,
Y.

Hi,

This type of address is set when Exchange Server is used to send/receive emails from Outlook.

Could you please manually delete the From address in the msg file using Microsoft Outlook and then check if the email delivers successfully?