Sending Email thu SSL/TLS using System.Net.Mail SmtpClient

Discussion in 'Site Programming, Development and Design' started by JayM, Jul 13, 2020.

  1. Hi -
    I'm trying to send SSL/TLS Email via SmtpClient. My domain's email server is m06.internetmailserver.net.
    I have tried
    using (var smtp = new SmtpClient("m06.internetmailserver.net")) {
    smtp.EnableSsl=true,
    smtp.UseDefaultCredentials = false;
    var credential = new System.Net.NetworkCredential
    {
    UserName = "fully qualified user name",
    Password = "corrrectpassword"
    };
    smtp.Credentials = credential;
    smtp.Port = 25; //25 465 587
    }
    Port 25, 465, and 587 have been tried to no avail. I am running this code on my computer at home and I am able to utilize encrypted sessions to my domain's email via Thunderbird, so I don't think there are firewall related issues on my local LAN. Any suggestions are appreciated.
    Jay
     
  2. Elshadriel

    Elshadriel Winhost Staff

    Don't set smtp.EnableSsl = true.
     
  3. Thank you.
     
  4. What I used to get this to work was:
    1. Use the Login/Password account of the Postmaster for the domain
    2. Port 587
    3. EnableSSL=False
    4. Web.config System.Web trust level set to Full
    5. The Smtp Server was mail.mydomain.com
    6. The application was loaded on to my domain's winhost server, not from software running on my desktop.
     
    Elshadriel likes this.

Share This Page