从asp.net发送电子邮件时MailBox不可用的消息

时间:2013-07-02 06:35:31

标签: asp.net email iis smtp asp.net-membership

我正在尝试从 asp.net登录页面发送注册电子邮件。但控制台显示此错误..

Uncaught Sys.WebForms.PageRequestManagerServerErrorException: Sys.WebForms.PageRequestManagerServerErrorException: Mailbox unavailable. The server response was: Delivery is not allowed to this address. 

导致此错误,代码或 stmp服务器的错误配置的原因。我在商业服务器上托管而不是我自己的。

1 个答案:

答案 0 :(得分:0)

yourClientName.DeliveryMethod = SmtpDeliveryMethod.Network;

例如:

SmtpClient client;
client = new SmtpClient("smtp.myserver.com", 25);

if (!string.IsNullOrEmpty(""))
{
     System.Net.NetworkCredential credential = new NetworkCredential("", "");
     client.Credentials = credential;
}
client.UseDefaultCredentials = true;
client.DeliveryMethod = SmtpDeliveryMethod.Network;

了解更多详情: http://msdn.microsoft.com/en-us/library/system.net.mail.smtpdeliverymethod.aspx