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
You could try to test the connection by typing "telnet smtps.mydomain.com 465" in Command Promt(cmd).
Regards
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With