Share via


Send Email SMTP 465

Question

Wednesday, April 23, 2014 7:12 AM

SmtpClient does not support Implicit SSL.

How to send email using C# of Implicit SSL (SMTP SSL 465), other than gmail, yahoo... ?

Do we have any other class from .NET or how to achieve this ?

Your help will be very much greatful...

Thanks,

Dinesh

All replies (8)

Wednesday, April 23, 2014 11:30 PM ✅Answered

Hi,

You can use the following code:

MailMessage message = new MailMessage();
                message.To.Add("[email protected]");
                message.From = new MailAddress("[email protected]");
                message.Subject = "Test";
                message.SubjectEncoding = System.Text.Encoding.UTF8;
                message.Body = "Test";
                message.BodyEncoding = System.Text.Encoding.UTF8;
                message.IsBodyHtml = true;
                message.Priority = MailPriority.High;

                using (var client = new SmtpClient())
                {
                    client.Credentials = new System.Net.NetworkCredential("username", "password");
                    client.Port = 465;
                    client.Host = "host";
                    client.EnableSsl = true; 

                    client.Send(message);
                }

João Sousa (MCTS) Senior Software Engineer


Wednesday, April 23, 2014 7:30 AM

smtpClient.EnableSsl = (smtpClient.Port == 465);

what i understood is that you want to enable the ssl for the smtpclient if the port is 465. above is the code for that.

explain more if this is not your requirement.


Wednesday, April 23, 2014 7:34 AM

Hi, please take a look at this:

http://stackoverflow.com/questions/1011245/how-can-i-send-emails-through-ssl-smtp-with-the-net-framework


Wednesday, April 23, 2014 9:04 AM

.NET built-in mail class doesn't support the needed SSL method (implicit SSL) and there's nothing to do with this: the reason is explained here.

There exist third-party SMTP client components that do both explicit and implicit SSL and have other cool functions. For example, Rebex.Mail or our SecureBlackbox.

Please mark the post as an answer that helps/solves your problem.


Monday, August 11, 2014 4:46 AM

There is Time out problem seen in this code.plz rply why it is.

How to avoid this?


Wednesday, December 16, 2015 7:46 PM

This code does not work for me when trying to send SSL emails via a well-known commercial hosting company's secure mail server on port 465; they require username/password. I can send non-SSL mail fine, but authenticated SSL mail always times out. Do you know for certain that this code works?


Monday, February 15, 2016 3:24 PM | 2 votes

It doesn't work because System.Net.Mail doesn't support Implicit SSL.


Monday, September 18, 2017 10:38 PM

This does not work. You should test your own suggestions.