C# ASP.NET 通过 TLS 发送电子邮件

发布于 2024-08-17 21:08:35 字数 481 浏览 5 评论 0原文

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

我以前从未使用过 TLS,对它也不是很熟悉。在 Google 上搜索会出现许多付费使用的库。 .NET 是否有任何原生工具可以实现此目的?如果是这样,我该如何配置它?如果没有,有免费或开源的东西吗?

当前配置:

  • ASP.NET C# Web 应用程序
  • 2.0 框架
  • 使用 System.Net.Mail 通过 SMTP 发送电子邮件和附件
  • IIS 6.0

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.

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?

Current Configuration:

  • ASP.NET C# Web Application
  • 2.0 Framework
  • Using System.Net.Mail to send email and attachments via SMTP
  • IIS 6.0

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

蓝咒 2024-08-24 21:08:35

TLS(传输层安全性)是一个稍微宽泛的术语,它在保护 HTTP 通信方面取代了 SSL(安全套接字层)。因此,您需要做的是启用 SSL。

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.

枯叶蝶 2024-08-24 21:08:35

在 SmtpClient 上,您可以设置一个 EnableSsl 属性。

IE

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

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

i.e.

SmtpClient client = new SmtpClient(exchangeServer);
client.EnableSsl = true;
client.Send(msg);
遗弃M 2024-08-24 21:08:35

我几乎使用了与您相同的技术,但是我使用我的应用程序通过 WinForms 上的 Office 365 平台连接 Exchange Server。我也遇到了与您相同的问题,但能够通过使用对其他人上面给出的内容进行轻微修改的代码来完成。

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

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

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.

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文