我已经关注了MS的一个示例(开始使用EWS托管API)。
使用EmailMessage.Send发送邮件很方便,但是使用EmailMessage.SendAndSaveCopy它只会将电子邮件的副本保存在带有草稿图标的已发送文件夹中。没有例外。
任何想法?
try
{
ServicePointManager.ServerCertificateValidationCallback = CertificateValidationCallBack;
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
service.Credentials = new WebCredentials("nicholas", "XXXXXXX", "mydomain");
service.TraceEnabled = true;
service.TraceFlags = TraceFlags.All;
string exchangeUrl = "https://XXXXXXXX.local/EWS/Exchange.asmx";
service.Url = new Uri(exchangeUrl);
EmailMessage email = new EmailMessage(service);
email.ToRecipients.Add("xx@xxxxxx.se");
email.Subject = "HelloWorld";
email.Body = new MessageBody("This is the first email I've sent by using the EWS Managed API");
email.SendAndSaveCopy(WellKnownFolderName.SentItems);
// email.Send(); // SEND WORKS
}
catch (Exception ex)
{
}
答案 0 :(得分:0)
不需要email.SendAndSaveCopy(WellKnownFolderName.SentItems); 使用email.SendAndSaveCopy(); https://msdn.microsoft.com/en-us/library/dd634557(v=exchg.80).aspx