我正在开发一个发送电子邮件的应用程序,它具有使用用户的Windows凭据发送电子邮件的组件之一。使用应用程序用户的Windows凭据发送电子邮件
string SMTP = "smtp.corp.com";
MailMessage msg = new MailMessage(Sender, Recipient, Subject, Body);
SmtpClient smtpclient = new SmtpClient(SMTP, 25);
smtpclient.EnableSsl = false;
smtpclient.UseDefaultCredentials = true;
msg.IsBodyHtml = true;
ServicePointManager.ServerCertificateValidationCallback = delegate(object s,X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; };
smtpclient.Send(msg);
这个代码工作的本地计算机上,但该服务器是给错误
Mailbox unavailable. The server response was: 5.7.1 Client does not have permissions to send as this sender
因为在这种情况下,发送方在部署后罚款:
string Sender = HttpContext.Current.User.Identity.Name+"@corp.com";
感谢
的可能重复[.NET SMTP客户端 - 客户端没有权限发送的该发件人(http://stackoverflow.com/questions/7269174/net-smtp-client-client-does-not-have-权限发送作为这个发件人) –
这有帮助吗? http://stackoverflow.com/questions/7269174/net-smtp-client-client-does-not-have-permissions-to-send-as-this-sender –