.Net smtp not sending emails, no errors

19,069

You could try to test the connection by typing "telnet smtps.mydomain.com 465" in Command Promt(cmd).

Regards

Share:
19,069
Admin
Author by

Admin

Updated on June 08, 2022

Comments

  • Admin
    Admin almost 2 years

    I am trying to send email through the web application using my client organisation's email server. The following is the code I am using.

    MailMessage MyMailMessage = new MailMessage();
    MyMailMessage.Subject = "Email testing";
    MyMailMessage.From = new MailAddress("[email protected]", "My name");
    MyMailMessage.To.Add(new MailAddress(strEmail, "Applicant"));
    
    SmtpClient mySmtpClient = new SmtpClient();
    mySmtpClient.EnableSsl = true;
    mySmtpClient.Send(Accepted);
    

    Web.config file:

    <mailSettings>
      <smtp deliveryMethod="Network" from=" [email protected]">
        <network host="smtps.mydomain.com" port="465" enableSsl="true" defaultCredentials="true"
        userName="myName" password="myPassword" />
      </smtp>
    </mailSettings>
    

    It works perfectly fine when I use gmail smtp details or my local organisation's smtp details. For some reason, its not working and neither is it throwing any errors.

    I have tried debugging and checked the exception which says 'timed out'.

    I am not sure what else to check. Could someone please suggest a solution.

    Note: I have also checked that no firewall is blocking port:465.

    Thank you.

    Kind regards,

    Sud

  • Techie Joe
    Techie Joe over 10 years
    Also checking the log files could determine if you're having DNS sending issues.