用模拟帐号后,发送邮件时提示:发送失败,原因:The request failed. 远程服务器返回错误: (401) 未经授权。请问下这是什么原因啊
原因很简单,没有通过身份认证。
您的意思是模拟帐号权限不够?还是说没有模拟成功。我的模拟帐号代码如下:
View Code
System.Net.ServicePointManager.ServerCertificateValidationCallback =
delegate(Object obj, X509Certificate ertificate, X509Chain chain, SslPolicyErrors error)
{
return true;
};
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010);
service.Url = new Uri("");
NetworkCredential credential=new NetworkCredential("","","");
service.Credentials = credential;
if (!string.IsNullOrEmpty(@"aa\00"))
{
service.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.PrincipalName, @"aa\00");
}
一直忘了过来结贴了,其原因是去掉帐号前面的域就行了