I’d like to create a message and save it in the drafts folder on a users mailbox on the exchange server.
Thanks for writing to Aspose.Email support team.
Aspose.Email provides rich features to handle exchange server. You can create and save a message in drafts folder as UNSENT and then later can send this message to the intended recipients. Message can be marked as draft message by adding a header “X-Unsent” and assigning value “1” to it.
Following is the sample code which demonstrates this feature:
const string domain = @""; const string username = @“username”; const string password = @“password”; NetworkCredential credential = new NetworkCredential(username, password, domain); ExchangeWebServiceClient _client = new ExchangeWebServiceClient(“https:[//exchange.domain.com/ews/Exchange.asmx](https://exchange.domain.com/ews/Exchange.asmx)”, credential); string draftsUri = _client.GetMailboxInfo().DraftsUri; MailMessage msg = new MailMessage(); msg.From = "email@example.com"; msg.To = "firstname.lastname@example.org"; msg.TextBody = “Email Message detail”; msg.Subject = “This is the draft message subject”; msg.Headers.Add(“X-Unsent”, “1”); _client.AppendMessage(draftsUri, msg);
Please feel free to write us back if you have any other query related to Aspose.Email as we will be more than happy to assist you further.
Thanks for the quick reply. This does put the message in the drafts.
Oh by the way, the Exchange server is 2003.