Mailbox unavailable. The server response was: 5.7.1 Unable to relay for

Mailbox unavailable. The server response was: 5.7.1 Unable to relay for
private void SendMAil()
    {
        NetworkCredential loginInfo = new NetworkCredential("info@syndromeindia.com", "troikainfo");
        MailMessage msg = new MailMessage();
        msg.From = new MailAddress("info@syndromeindia.com");
        msg.To.Add(new MailAddress("jr@syndromeindia.com"));
        msg.Subject = "Demo";
        msg.Body = "Code of vidya";
        msg.IsBodyHtml = true;
        SmtpClient client = new SmtpClient("syndromeindia.com");
        client.EnableSsl = false;
        client.UseDefaultCredentials = false;
        client.Credentials = loginInfo;
        client.Send(msg);
}

Open in new window

RaoSyndromeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

tomandCommented:
Hi,

you are trying to send a message using a SMTP server which doesn't allow you to relay (send message which has to be delivered to another mail server). Use SMTP server which belongs to your ISP (and follow ISP's recommendations. ISP usually idetifies its custormers by IP addresses. It can allow relay for authentified users too). Or you can use another SMTP server but it should require another security features like SMTP authentication)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
quizwedgeCommented:
If the SMTP server will let you log in to authenticate yourself, you can do as tomand suggested.  Here's a link to code for authenticating and sending mail: http://www.aspnettutorials.com/tutorials/email/email-auth-aspnet2-csharp.aspx
0
balbirsingh1976Commented:
hi,

the following code worked for me:

Code:
Dim mm As New MailMessage(fromaddress, toaddress)
mm.Subject =  "Subject "
mm.IsBodyHtml = True
mm.Body = ""
Dim smtp As New SmtpClient
smtp.Host = "smtp.yourdomainname.com"   'Modify smtp server name as per your requirement
smtp.Port = "25"   'Modify port number as per your requirement
smtp.Send(mm)

web .config Code :
<smtp>
<network host="smtp.alkasecurities.com" userName="yourusername@yourdomainname.com" password="yourpassword"/>
</smtp>

Regards
Balle
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Email Clients

From novice to tech pro — start learning today.