Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.Net smtp not sending emails, no errors

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

like image 808
user2842085 Avatar asked Nov 12 '22 21:11

user2842085


1 Answers

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

Regards

like image 127
windowshostingasp.net Avatar answered Nov 14 '22 23:11

windowshostingasp.net