C # ASP.NET Send Email via TLS

To meet the HIPAA requirements, we need to send an email from an external site (outside the firewall) to the internal Exchange server (inside the firewall). Our Exchange administrators tell us that we need to use TLS encryption to send mail from a web server to an email server.

I have never used TLS before, and I am not very familiar with it. A search on Google, as well as many numerous usage fees. Is there anything native to .NET that will do this? If so, how to configure it? If not, is there something free or open source?

Current configuration:

  • ASP.NET C # Web Application
  • 2.0 Framework
  • Using System.Net.Mail to send email and attachments via SMTP
  • IIS 6.0
+41
Jan 13 '10 at 14:18
source share
3 answers

TLS (Transport Level Security) is a slightly broader term that has replaced SSL (Secure Sockets Layer) to protect HTTP messages. So what you are asked to do is enable SSL.

+52
Jan 13
source share

SmtpClient has the EnableSsl property that you set.

i.e.

SmtpClient client = new SmtpClient(exchangeServer); client.EnableSsl = true; client.Send(msg); 
+21
Jan 13 '10 at 14:29
source share

I almost used the same technology as you, however I used my application to connect Exchange Server through the Office 365 platform on WinForms. I, too, had the same problem as you, but was achieved using code that has a slight modification to what others gave above.

 SmtpClient client = new SmtpClient(exchangeServer, 587); client.Credentials = new System.Net.NetworkCredential(username, password); client.EnableSsl = true; client.Send(msg); 

I had to use port 587, which, of course, is the default port for TSL, as well as authentication.

+17
Feb 05 '13 at
source share



All Articles