the server rejected one or more recipient addresses. the server response was 550 5.7.1 unable to relay

20,621

Solution 1

I'll assume that there is nothing wrong in your code. I guess it is a configuration issue i.e SMTP server configured to not send emails to addresses that are not part of your company domain. If so you need to check with your Windows/Network team to confirm configuration applied at SMTP server level.

Solution 2

I have Solved this problem. For using this code you need to add the namespace Using System.Web.Mail;

Source Code:

MailMessage mail = new MailMessage();

mail.To = "[email protected]";

mail.From = "[email protected]";

mail.Subject = "Email test.";

mail.Body = "Your body text here";

mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");   //basic authentication

mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "my_username_here"); //set your username here

mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "super_secret");       //set your password here

SmtpMail.SmtpServer = "127.0.0.1";  

SmtpMail.Send( mail );

//your need to add localhost address to IIS Manager. Goto IIS Manager -> Default SMTP Server ->Properties -> Access -> Relay -> allow only from the list below -> add -> 127.0.0.1 -> Click OK

Share:
20,621
Siva kumar Goru
Author by

Siva kumar Goru

Updated on July 07, 2022

Comments

  • Siva kumar Goru
    Siva kumar Goru almost 2 years

    I am sending mails using our company SMTP server. I get the problem when I am sending mail to other mails (out side of the company domain), returning the error:

    "The server rejected one or more recipient addresses. The server response was 550 5.7.1 unable to relay".

    If the mail is within the company, then there is no error and mail sending successfully. My web application hosted in IIS.