0 votes
by (8.5k points)

I'd like to create a mail message file (.MSG or .EML) to be opened in e-mail client (e.g. in Outlook). When an user opens the file, he/she can just fill the recipient's address and send the prepared message.

Unfortunately, the message files created using the MailMessage.Save method seems to be read-only (I cannot modify neither the recipient nor the message body}. I can only reply or forward the message.

Applies to: Rebex Secure Mail

1 Answer

0 votes
by (18.0k points)

You can make the message read-write by setting the X-Unsent flag into the message headers:

var msg = new MailMessage();
msg.Subject = "Subject";
msg.Headers.Add("X-Unsent", "1");  // <-- that's it
msg.BodyHtml = "Mail body...";

It should work both for .EML and .MSG message formats.

...