[c#] _配置在服务器中发送邮件EWS [英] [c#] _ Config to Send mail EWS in server
本文介绍了[c#] _配置在服务器中发送邮件EWS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
请帮我解释为什么我建立一个发送邮件的项目,当我在我的电脑上运行时就可以了,所以我在另一台服务器上运行时出现错误远程服务器返回错误:(401)未经授权。我不知道这是我的代码错误或服务器配置我的帐户。
这是我的代码
Hi every body,
Please help me why i build a project to send mail, when i run at my computer that ok, So i run on another server have a error "The remote server returned an error: (401) Unauthorized.". I dont know that is my code error or server config my account.
This is my code
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
ExchangeService service = new ExchangeService(Microsoft.Exchange.WebServices.Data.ExchangeVersion.Exchange2007_SP1);
service.Credentials = new WebCredentials(@"domain\myuser", "mypass");
service.Url = new System.Uri("https://mail.domain.com/EWS/Exchange.asmx");
EmailMessage email = new EmailMessage(service);
email.ToRecipients.Add(MrK, mrk@domain.com);
email.Subject = "Test From Smart's Server";
email.Body = new MessageBody(string.Format(_body_mail, prnumber, "hey you", purposeofpur));
email.Send();
非常感谢
Thank you so much
推荐答案
是的,我真的已经完成了。非常感谢所有,它错误,因为我在服务器上的用户不应该有域名\
yeah, i really done already. thank so much all, it error because my user on server should'nt have domain\
这篇关于[c#] _配置在服务器中发送邮件EWS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文