Save OutlookMsg as Draft, when open should get Send option

0 votes
asked May 21, 2013 by lokinshah (160 points)
edited May 22, 2013

Hi, We are trying to create and save a OutlookMsg as below.

Approach 1:

MailMessage message = new MailMessage();
message.MessageId = new Rebex.Mime.Headers.MessageId(Guid.NewGuid().ToString());
message.To.Add("static@test.com");
message.Subject = "Subject";
message.BodyHtml = "Hello RebEx";

MemoryStream mailStream = new MemoryStream();
message.Save(mailStream, MailFormat.OutlookMsg);

Approach 2 :

Create email as above and then create reply

MailMessage newMessage = message.CreateReply(new Rebex.Mime.Headers.MailAddress("static@test.com"), ReplyBodyTransformation.None, true);

MemoryStream mailStream = new MemoryStream();
newMessage.Save(mailStream, MailFormat.OutlookMsg);

I have tried 2 ways to create and saved message.

But when I open that saved message, I do not get Send button, it shows Reply.. buttons.

My requirement is to create email using code with some existing template and then allow user to edit and send using Outlook.

Applies to: Rebex Secure Mail

1 Answer

+1 vote
answered May 21, 2013 by Lukas Matyska (54,110 points)
edited May 22, 2013
 
Best answer

To achieve your requirement please add the "X-Unsent: 1" header to the mail. It can be done like this:

// create message ...

// add "X-Unsent: 1" header 
message.Headers.Add("X-Unsent", "1");

// save message ...
commented May 22, 2013 by lokinshah (160 points)
edited May 22, 2013

Thanks it worked.

...