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 http://support.Winhost.com/KB/a650/how-to-send-email-in-aspnet.aspx 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("mail.outthedoghouse.com.au");
    smtp.Credentials = new NetworkCredential("[email protected]", **Password**);
    //smtp.Port = 25; // also I not tried with 587;
    smtp.Port = 587;

    // Send the message
    smtp.Send(mail);

    Can you tell me why this is so?

    The Domain in question is "outthedoghouse.com.au"
    the mx record resolves to m04.internetmailserver.net
     
    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");
    mailMsg.AlternateViews.Add(htmlView);
    SmtpClient smtp = new SmtpClient("mail.srpski-despot.com");
    NetworkCredential Credentials = new NetworkCredential("[email protected]", "****");
    smtp.Credentials = Credentials;
    //smtp.Port = 587;
    //smtp.Timeout = 20000;
    smtp.Send(mailMsg);
    lblRezultat.Text = "success";
    ==================

    web.config:
    ==============
    ....
    <system.web>
    <trust level="Full"/>
    ....
    ==============


    Before few months everything worked fine. But now same code not working. I get error:
    ========
    Mailbox unavailable. The server response was: <[email protected]> No such user here.
    ========

    [email protected] 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