Can't SendMail

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

Using Visual Web Developer 05 Express and this code:
using System.Web.Mail;

MailMessage mail = new MailMessage();
mail.BodyFormat = MailFormat.Html;

mail.To = txtEmailAddress.Text;

mail.From = "tgaughan@nuNO__SPAMmail.org";

mail.Subject = "Test";

string strBody = @"Test Body";

mail.Body = strBody;

SmtpMail.SmtpServer = "localhost";

SmtpMail.Send(mail);

The server rejected one or more recipient addresses. The server response
was: 550 5.7.1 Unable to relay for tgaughan@nuNO__SPAMmail.org

Thanks in advance...
 
You need to check your relay restrictions, probably add the IP.

Go to IIS and Right Click on SMTP Virtual Server then select Properties.

Click the Access tab.

Under "Relay Restrictions" add the IP Address of the server you are running
the code from.



Regards,

Brian K. Williams
 
Back
Top