Why do I have problem sending Email to external servers

Discussion in 'Site Programming, Development and Design' started by Micah, Feb 28, 2017.

  1. I have developed an ASP.NET webforms application. I'm trying to send a form filled to an internal account and then a copy to the email account of the user. I dont get any errors. Internal mails are sent while external emails dont get sent. I also noticed I could not send email from a some of my email accounts to external emails like gmail or yahoo, from even an email client application

    Here is the line of code :

    SmtpClient smtpClient = new SmtpClient("mail.domainhost.co.uk",25);
    NetworkCredential credentials = new NetworkCredential("userName", "password");
    smtpClient.Credentials = credentials;

    MailMessage mailMessage = new MailMessage(FromAddress,ToAddress,Enquiry,Message);
    mailMessage.IsBodyHtml=true;
    mailMessage.Priority = MailPriority.High;
    int i = 0;
    try
    {
    smtpClient.Send(mailMessage);
    i = 1;
    }
    catch(Exception e)
    {
    i = 0;
    }
    return i;

    Can I get help with this please?
     
  2. I am having a very similar problem. Were you ever able to resolve this?
     
  3. Elshadriel

    Elshadriel Winhost Staff

    When supplying SMTP authentication, make sure you use the full email address and password to that email address.
     
    Michael likes this.

Share This Page