c# ASP。NET通过TLS发送电子邮件

时间:2022-07-18 01:41:21

In order to comply with HIPAA regulations, we need to send email from an external site (outside the firewall) to an internal Exchange server (inside the firewall). Our Exchange admins tell us we need to use TLS encryption to send mail from the web server to the email server.

为了遵守HIPAA规则,我们需要从外部站点(防火墙外)向内部交换服务器(防火墙内)发送电子邮件。我们的Exchange管理员告诉我们,我们需要使用TLS加密从web服务器向电子邮件服务器发送邮件。

I've never used TLS before and I'm not very familiar with it. Searching on Google as brought up numerous paid-for-use libraries. Is there anything native to .NET that will accomplish this? If so, how do I configure it? If not, is there something free or open source?

我以前从未使用过TLS,我对它不是很熟悉。在谷歌上进行搜索时,会出现许多付费使用的库。有什么原生的。net可以实现这一点吗?如果是,我如何配置它?如果没有,有免费或开源的东西吗?

Current Configuration:

当前配置:

  • ASP.NET C# Web Application
  • ASP。净c#的Web应用程序
  • 2.0 Framework
  • 2.0框架
  • Using System.Net.Mail to send email and attachments via SMTP
  • 使用System.Net。通过SMTP发送电子邮件和附件
  • IIS 6.0
  • IIS 6.0

3 个解决方案

#1


58  

TLS (Transport Level Security) is the slightly broader term that has replaced SSL (Secure Sockets Layer) in securing HTTP communications. So what you are being asked to do is enable SSL.

TLS(传输层安全性)是在保护HTTP通信中取代SSL(安全套接字层)的稍微宽泛的术语。所以你要做的是启用SSL。

#2


23  

On SmtpClient there is an EnableSsl property that you would set.

在SmtpClient中,您将设置一个EnableSsl属性。

i.e.

即。

SmtpClient client = new SmtpClient(exchangeServer);
client.EnableSsl = true;
client.Send(msg);

#3


17  

I was almost using the same technology as you did, however I was using my app to connect an Exchange Server via Office 365 platform on WinForms. I too had the same issue as you did, but was able to accomplish by using code which has slight modification of what others have given above.

我几乎使用了和你一样的技术,但是我使用我的应用程序通过WinForms上的Office 365平台连接交换服务器。我也遇到了和你一样的问题,但是我能够通过使用代码来完成,代码对别人给出的内容进行了轻微的修改。

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

I had to use the Port 587, which is of course the default port over TSL and the did the authentication.

我必须使用端口587,这当然是TSL上的默认端口,并进行了身份验证。

#1


58  

TLS (Transport Level Security) is the slightly broader term that has replaced SSL (Secure Sockets Layer) in securing HTTP communications. So what you are being asked to do is enable SSL.

TLS(传输层安全性)是在保护HTTP通信中取代SSL(安全套接字层)的稍微宽泛的术语。所以你要做的是启用SSL。

#2


23  

On SmtpClient there is an EnableSsl property that you would set.

在SmtpClient中,您将设置一个EnableSsl属性。

i.e.

即。

SmtpClient client = new SmtpClient(exchangeServer);
client.EnableSsl = true;
client.Send(msg);

#3


17  

I was almost using the same technology as you did, however I was using my app to connect an Exchange Server via Office 365 platform on WinForms. I too had the same issue as you did, but was able to accomplish by using code which has slight modification of what others have given above.

我几乎使用了和你一样的技术,但是我使用我的应用程序通过WinForms上的Office 365平台连接交换服务器。我也遇到了和你一样的问题,但是我能够通过使用代码来完成,代码对别人给出的内容进行了轻微的修改。

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

I had to use the Port 587, which is of course the default port over TSL and the did the authentication.

我必须使用端口587,这当然是TSL上的默认端口,并进行了身份验证。