Question

I have this program that is trying to send an email to an outside address using an internal Exchange account, and I'm getting the following error:

"mailbox unavailable. the server response was 5.7.1 unable to relay"

We have Exchange 2010. I don't understand why, since the account I'm using to send is a local account. Here's my code:

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

No correct solution

OTHER TIPS

You need to authorize the user on exchange ( on the smtp receive connector) to send outside your company:

Get-ReceiveConnector "Default SMTP" | Add-ADPermission -User "COMPANY\Service" -ExtendedRights "ms-Exch-SMTP-Accept-Any-Recipient"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top