从本地Exchange帐户发送时“5.7.1无法中继”

时间:2013-12-10 23:00:43

标签: email smtpclient exchange-server-2010

我有这个程序试图使用内部Exchange帐户向外部地址发送电子邮件,我收到以下错误:

“邮箱不可用。服务器响应是5.7.1无法中继”

我们有Exchange 2010.我不明白为什么,因为我用来发送的帐户是本地帐户。这是我的代码:

Dim client As SmtpClient = New SmtpClient("webmail.company.com") 
client.DeliveryMethod = SmtpDeliveryMethod.Network
client.UseDefaultCredentials = False
client.Credentials = New NetworkCredential("Service", "pwd", "company")
Dim message As MailMessage = New MailMessage("service@company.com", "someone@outsidecompany.com")
Message.Body = "Test Message"
Message.Subject = "Hello"
client.Send(message)
message = Nothing

1 个答案:

答案 0 :(得分:0)

您需要在交换时(在smtp接收连接器上)授权用户向公司外部发送信息:

Get-ReceiveConnector "Default SMTP" | Add-ADPermission -User "COMPANY\Service" -ExtendedRights "ms-Exch-SMTP-Accept-Any-Recipient"