System.Net.Mail Error 550 Authentication required for relay

Discussion in 'ASP.NET / ASP.NET Core' started by we2j53d, Oct 28, 2009.

  1. I set up an email system with System.Net.Mail in my c# codebehind, and I get:

    host said: 550 Authentication is required for relay

    I used a credentials object and supplied the correct names/passwords, and tried through port 25 and port 587, but still get the same error.

    My smtp server is smtp.mydomain.com.

    What's the problem?
     
  2. Could you provide us with the code that you're using to send out the email?

    Also, you could always try sending through "localhost", which doesn't require authentication, so it's definitely a lot easier that way.
     
  3. Here's the code:

    MailMessage msg = new MailMessage();

    msg.From = new MailAddress("[email protected]");
    msg.Subject = <subject>;
    msg.BodyEncoding = Encoding.ASCII;
    msg.IsBodyHtml = true;
    msg.Body = message;
    msg.To.Add(new MailAddress("[email protected]"));

    System.Net.NetworkCredential info = new System.Net.NetworkCredential(
    "[email protected]", <password>);
    SmtpClient sc = new SmtpClient("smtp.coactumsolutions.com", 587);
    sc.UseDefaultCredentials = false;
    sc.Credentials = info;
    sc.Send(msg);
     
  4. Bruce

    Bruce DiscountASP.NET Staff

    Are you sure the username / password is correct?

    Is this app hosted on our server? If so, switch to localhost as the SMTP server.
     

Share This Page