信箱不可用。服务器响应为:5.7.1无法中继

时间:2017-06-21 08:04:44

标签: c# asp.net asp.net-mvc web exchange-server

相同的ASP.NET MVC 4网站,相同的邮件发送代码。从AccountController发送电子邮件消息不再适用于所有其他控制器。

以下是我从AccountController操作中得到的错误:

Cannot send e-mail from noreply@domain.com to bill@microsoft.com
Exception: Mailbox unavailable. The server response was: 5.7.1 Unable to relay.
mail.domain.com, SMTPSVC/mail.domain.com, 25, 

我应该检查什么?它工作多年,但最近的Windows Server 2008 / Exchange 2010更新不再起作用。

MailMessage message = new MailMessage(fromAddress, toAddress)
{
   Subject = subject,
   Body = body,
   IsBodyHtml = isHtml
};

try
{
   smtpClient.Send(message);

   string errorMsg = "Sending e-mail from " + fromAddress.Address + " to " + originalAddresses[i];
   errorMsg += Environment.NewLine;
   errorMsg += smtpClient.Host + ", " + smtpClient.TargetName + ", " + smtpClient.Port + ", " + smtpClient.ClientCertificates + ", " + smtpClient.EnableSsl + ", " + smtpClient.UseDefaultCredentials + ", " + smtpClient.Timeout;

   sw.WriteLine(errorMsg)
}
catch (Exception ex)
{
   string errorMsg = "Cannot send e-mail from " + fromAddress.Address + " to " + originalAddresses[i] + ", " + "Exception: " + ex.Message +
                                (ex.InnerException != null ? ", " + ex.InnerException.Message : string.Empty);
   errorMsg += Environment.NewLine;
   errorMsg += smtpClient.Host + ", " + smtpClient.TargetName + ", " + smtpClient.Port + ", " + smtpClient.ClientCertificates + ", " + smtpClient.EnableSsl + ", " + smtpClient.UseDefaultCredentials + ", " + smtpClient.Timeout;

   sw.WriteLine(errorMsg);

   return false;
}

我应该知道应该检查什么? AccountController有什么特别值得我关注的吗? [RequireHttps]控制器操作属性是否有所涉及?

感谢。

EDIT1:

以下是我们的Exchange 2010设置(请注意,我们可以从其他ASP.NET MVC控制器发送相同的电子邮件):

https://practical365.com/exchange-server/how-to-configure-a-relay-connector-for-exchange-server-2010/

EDIT2:

我错了,问题不在于ASP.NET MVC控制器相关但与电子邮件地址域相关。我发现,我们一直包含一个不属于我们公司域(外部互联网)的电子邮件地址,我们得到上述错误。所以现在的问题是:为什么Exchange 2010接收连接器现在无法向外部互联网发送电子邮件通知?

1 个答案:

答案 0 :(得分:0)

服务器场更改了我们服务器的传出IP地址,这阻止了包含不在我们公司域中的收件人的所有电子邮件。将新的传出IP地址添加到Properties->Network->Receive mail from remote servers that have these IP addresses下的Exchange 2010接收连接器解决了该问题。