Quantcast
Channel: Aspose.Email Product Family
Viewing all articles
Browse latest Browse all 1367

EWSClient save MailMessage as msg after sending

$
0
0
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.  
  4.             MailMessage beforeSent = newMailMessage();
  5.             beforeSent.From = "TestAddress@myDomain.com";
  6.             beforeSent.To.Add("TestAddress@myDomain.com");
  7.             beforeSent.Subject = "TestMail";
  8.             beforeSent.Body = "TestMail";
  9.  
  10.             exchange.Send(beforeSent);
  11.  
  12.             // And here is what I think whould be the best solution
  13.             MailMessage afterSent = exchange.Send(beforeSent);
  14.             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

Viewing all articles
Browse latest Browse all 1367

Trending Articles