Using the System.Net.Mail namespace the code used is as below.
MailMessage MyMailMessage = new MailMessage("[email protected]", "[email protected]",
"write your subject Here ", "Hi,This is the test message ");
MyMailMessage.IsBodyHtml = false;
NetworkCredential mailAuthentication = new NetworkCredential("[email protected]","xxxxxxxx");
SmtpClient mailClient = new SmtpClient("smtp.gmail.com", 465);
mailClient.EnableSsl = true;
mailClient.DeliveryMethod = SmtpDeliveryMethod.Network;
mailClient.UseDefaultCredentials = false;
mailClient.Credentials = mailAuthentication;
mailClient.Send(MyMailMessage);
Using the above code timeout exception happens if 465 port is used. 25 port works fine. In the case of yahoo account both 465 and 25 gives failure sending mail.
Is there anyway 465 port can be supported for sending mails using gmail or yahoo account.
Refered the following link http://blogs.msdn.com/b/webdav_101/archive/2008/06/02/system-net-mail-with-ssl-to-authenticate-against-port-465.aspx
Is states that Windows Mail uses System.Net.Mail to send messages - wont work with Implicit SSL.
Is there any solution to fix this problem.
Thanks in advance
This is not an answer to the problem but .NET built-in mail class doesn't support the needed implicit SSL method.You have to use third-party SMTP client components for this purpose which are capable of both explicit and implicit SSL.
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