I am trying to send email through a web application using my organization client email server. Below is the code I'm using.
MailMessage MyMailMessage = new MailMessage();
MyMailMessage.Subject = "Email testing";
MyMailMessage.From = new MailAddress("name@mydomain.com", "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=" name@mydomain.com">
<network host="smtps.mydomain.com" port="465" enableSsl="true" defaultCredentials="true"
userName="myName" password="myPassword" />
</smtp>
</mailSettings>
It works fine when I use the gmail smtp details or the smtp details of my local organization. For some reason, it does not work, and does not cause any errors.
I tried debugging and checking for an exception that says "timeout".
I'm not sure what else to check. Maybe someone can suggest a solution.
Note. I also checked that the firewall is not blocking port: 465.
Thanks.
Yours faithfully,
Sud
source
share