System.Web.Mail is working correctly, and is attempting to send the email. However, your SmtpMail.SmtpServer is not allowing relaying. Try one of the following suggestions:
- Make sure the MailMessage.From is a valid email address that exists on the SmtpMail.SmtpServer.
- Allow relaying for your MailMessage.From address (see your specific mail server documentation for this)
- Allow relaying for your IP Address (see your specific mail server documentation for this).
- Try authenticated first, before sending the email. Check out 3.8 How do I authenticate to send an email?
- If you are using the IIS SMTP Service try allowing relaying for your IP address by:
- Opening the IIS Admin MMC
-
Right-Clicking on the SMTP Virtual Server and selecting Properties
-
On the Access tab, click the Relay button
-
Grant 127.0.0.1 (or the IP address used by System.Web.Mail) to the Computers list.
-
Close all dialogs
-
Restarting the SMTP Service