问题
I am using the below code; One of the following points could be the reason of the error, but I don't know;
1-The application is on development machine 2-The smtp ip is hosted on the server while app is running on localhost
I am getting this error "Mailbox unavailable. The server response was: 5.7.1 Unable to relay for mhtbusoum@gmail.com";
Dim message As New MailMessage
message.From = New MailAddress(Strings.LCase("mhtbusoum@mysite.com"))
message.To.Add("mhtbusoum@gmail.com")
message.IsBodyHtml = True
message.Priority = MailPriority.Normal
message.Subject = ("Testing SmtpClient email sending")
message.Body = ("It is to test the email sending without any password")
Dim client As New SmtpClient("mailSending.actualSite.com", 25)
client.UseDefaultCredentials = False
client.Send(message)
回答1:
When using localhost as mail server, the server will block any e-mail address that is not hosted in localhost.
To relay another e-mail address from other server, you will need to configure the IIS Server to grant the permission.
See this post for configure the relay permissions.
回答2:
Try this..
Find IIS6 manager (I have found that searching for IIS may return 2 results) go to the SMTP server properties then 'Access' then press the relay button.
Then you can either select all or only allow certain ip's like 127.0.0.1

来源:https://stackoverflow.com/questions/11505914/mailbox-unavailable-the-server-response-was-5-7-1-unable-to-relay-for-abcgmai