通过ExchangeService 发送邮件

时间:2021-10-17 18:20:34

 

ExchangeService service = new ExchangeService();
service.Url = new Uri("https://***(host)/ews/exchange.asmx");
service.Credentials= new WebCredentials("username", "password");

//service.AutodiscoverUrl("ssss@xxxx");

EmailMessage message = new EmailMessage(service);
message.Subject ="主题";
message.Body ="内容";
message.ToRecipients.Add("email");
message.ToRecipients.Add("email");
message.Save();

message.SendAndSaveCopy();

 

下载(包含Microsoft.Exchange.WebServices.dll)