SMTP from local host

Discussion in 'Email' started by cossy74, Jul 2, 2013.

  1. Hi,
    I have tried to use the example code found at but I am getting a Unable to connect to the remote server exception.

    here is my code

    // Create the smtp client
    var smtp = new SmtpClient("");
    smtp.Credentials = new NetworkCredential("", **Password**);
    //smtp.Port = 25; // also I not tried with 587;
    smtp.Port = 587;

    // Send the message

    Can you tell me why this is so?

    The Domain in question is ""
    the mx record resolves to
    Last edited by a moderator: Oct 14, 2015
  2. Elshadriel

    Elshadriel Winhost Staff

    Last edited by a moderator: Oct 14, 2015
  3. Update:

    Elshadriel: the web config already as this setting.

    I have made a Test project in visual studio and can run this exact code and get the email to go through.
    So it looks like this i a problem when running in the web environment from visual studio.
  4. Elshadriel

    Elshadriel Winhost Staff

    It might be another configuration setting in your web.config file. You should try uploading a test script and a more simplified web.config file. If it works, then you know there is some setting in the web.config that you need to modify.
  5. I have same problem with. Everything worked fine but now not working.

    My peace of code:

    AlternateView htmlView = AlternateView.CreateAlternateViewFromString(bodyHTML, null, "text/html");
    SmtpClient smtp = new SmtpClient("");
    NetworkCredential Credentials = new NetworkCredential("", "****");
    smtp.Credentials = Credentials;
    //smtp.Port = 587;
    //smtp.Timeout = 20000;
    lblRezultat.Text = "success";

    <trust level="Full"/>

    Before few months everything worked fine. But now same code not working. I get error:
    Mailbox unavailable. The server response was: <> No such user here.
    ======== email address where I send e-mail.
  6. Elshadriel

    Elshadriel Winhost Staff

    Double check that you're entering the correct password. You might get that message if you fail SMTP authentication.

Share This Page