EWSClient save MailMessage as msg after sending

Hi folks,


can you please tell me how to save a MailMessage to a msg-file after it has been sent.
(saved .msg file should contain the DateTime the mail was sent)

actually I am using the following code to construct a MailMessage


Code Snippet
  1. string exchangeServiceUrl = "http://myDomain/ews/exchange.asmx";
  2. IEWSClient exchange = EWSClient.GetEWSClient(exchangeServiceUrl, CredentialCache.DefaultNetworkCredentials);
  3. MailMessage beforeSent = new MailMessage();
  4. beforeSent.From = "TestAddress@myDomain.com";
  5. beforeSent.To.Add("TestAddress@myDomain.com");
  6. beforeSent.Subject = "TestMail";
  7. beforeSent.Body = "TestMail";
  8. exchange.Send(beforeSent);
  9. // And here is what I think whould be the best solution
  10. MailMessage afterSent = exchange.Send(beforeSent);
  11. afterSent.Save("C:\\EmailWithSentInfos.msg");

if there is other way then searching “SentItems”-Folder after sending the mail, how to find the correct mail (if two mails hav the same sender, recipients, subject and body texts.)


kind regards
Markus

Hi Markus,


Thank you for posting your inquiry.

At present, the Exchange.Send doesn’t return any object of sent message as MailMessage. We’ve logged your requirement as EMAILNET-38656 for further consideration by our Product team. Something like:

MailMessage afterSent = exchange.Send(beforeSent);

or

string uri = exchange.Send(beforeSent);

may be provided as consideration in this ticket. We’ll let you know once there is such a provision available in the API.

Hi Markus,


This is to update you about the status of EMAILNET-38656. We have investigated different kinds of implementation for this feature, but all of them lead to increased time of operation and complexity of implementation. This results in performance hit which is more important for many of our valued customers/users including you. Keeping in view the performance issue, this feature won’t be implemented. We appreciate your understanding in this regard.