c# - 更新 SSL 设置后无法通过 SMTP 发送电子邮件

标签 c# ssl smtpclient

我在家中使用 IIS7.5 运行服务器,最近在其上运行了 SSL 测试 ( https://www.ssllabs.com/ssltest )。它返回建议更改我用来消除不推荐使用的密码套件的密码套件。我按照这里的说明操作:https://weakdh.org/sysadmin.html (向下滚动到 Microsoft IIS)。我现在使用的密码套件来自这里:https://weakdh.org/sysadmin.html1.1 现代兼容性 下。显然,这是最严格的限制。

现在,当我尝试使用 SmptClient 发送电子邮件时,出现以下错误:

A call to SSPI failed, see inner exception.

内部异常:

The client and server cannot communicate, because they do not possess a common algorithm

我正在通过 smtp.gmail.com 发送电子邮件,我认为它支持现代密码套件(错误的假设?)。

最佳答案

您使用什么 .NET 版本? .NET 4.6 自动使用 TLS 1.2,但 .NET 4.5 等旧版本默认不使用 TLS 1.2。希望对您有所帮助。

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; // .NET 4.5
ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072; // .NET 4.0

关于c# - 更新 SSL 设置后无法通过 SMTP 发送电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33790331/

相关文章:

authentication - Marathon - SSL 和基本访问身份验证

php - Wordpress 有一个讨厌的重定向不允许 ssl

.NET SmtpClient : Is there a way to make sure that all emails resolve prior to sending MailMessage?

c# - IReflect 和 DispId

c# - 如何将文件上传到 blob 存储并从附件中的 cosmosdb 文档引用它

C#音乐/声音同步

c# - 我的 .csproj 使用的是 .NET 项目系统还是通用项目系统

android - Qt Android 构建 SSL 错误

c# - 循环 SmtpClient.Send()

.net - .NET 3.5 中的 SmtpClient SendAsync