S
sanjeev
I am attempting to send an email from a C# app and get the following
error -
[System.Web.HttpException] = {"The server rejected one or more
recipient addresses. The server response was: 554 Relay rejected for
policy reasons.\r\n"}
I can only send emails to addresses within my domain. What do I have to
do in order to ensure that the mail server allows the emails to outside
addresses. I have attempted using classes from System.Net.Mail and
System.Web.Mail and get the same error if sending mail outside my
domain.
Here is a code snippet (I have edited the username/pwd) -
--------------------------------------------------------------------------------------------------------------------
System.Web.Mail.MailMessage mail = new
System.Web.Mail.MailMessage();
mail.From = "(e-mail address removed)";
mail.To = "(e-mail address removed)";
mail.Subject = "This is an email";
mail.Body = "The tulips are blooming!";
try
{
//to authenticate we set the username and password
properites on the SmtpClient
// SmtpClient smtp = new SmtpClient("192.168.1.7");
//smtp.Credentials = new NetworkCredential("username",
"pwd");
//smtp.Send(mail);
System.Web.Mail.SmtpMail.SmtpServer = "192.168.1.7";
System.Web.Mail.SmtpMail.Send(mail);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
error -
[System.Web.HttpException] = {"The server rejected one or more
recipient addresses. The server response was: 554 Relay rejected for
policy reasons.\r\n"}
I can only send emails to addresses within my domain. What do I have to
do in order to ensure that the mail server allows the emails to outside
addresses. I have attempted using classes from System.Net.Mail and
System.Web.Mail and get the same error if sending mail outside my
domain.
Here is a code snippet (I have edited the username/pwd) -
--------------------------------------------------------------------------------------------------------------------
System.Web.Mail.MailMessage mail = new
System.Web.Mail.MailMessage();
mail.From = "(e-mail address removed)";
mail.To = "(e-mail address removed)";
mail.Subject = "This is an email";
mail.Body = "The tulips are blooming!";
try
{
//to authenticate we set the username and password
properites on the SmtpClient
// SmtpClient smtp = new SmtpClient("192.168.1.7");
//smtp.Credentials = new NetworkCredential("username",
"pwd");
//smtp.Send(mail);
System.Web.Mail.SmtpMail.SmtpServer = "192.168.1.7";
System.Web.Mail.SmtpMail.Send(mail);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}