gpt4 book ai didi

c# - 从 Office 365 发送电子邮件不再支持基本身份验证和 SMTP

转载 作者:行者123 更新时间:2023-12-02 23:37:15 25 4
gpt4 key购买 nike

我们发现最近我们的电子邮件无法进行身份验证。在找到此类操作的原因后,我们发现 Office 365 管理员中的一项策略导致了此问题。

Further, we also found out that it's being blocked by a policy thatsays our App uses a Legacy Authentication scheme. Later it wasunderstood that Microsoft will stop allowing Basic Authentication(Passing a Username and Password as for credentials) in the future andany connection which uses IMAPI, POP and SMTP protocols forconnection. Further communication on Office 365 platform should beon minimum TLS 1.1 or 1.2

我正在 Azure 中使用 Web 作业来执行电子邮件,并为此 System.Net.Mail.SmtpClient用于发送电子邮件。此 Web 作业执行批量电子邮件。我已在 SSL/TLS 属性下检查了我的应用服务,并设置了仅 HTTPS 和 TLS 1.2。但是,我使用基本身份验证作为身份验证方法。以下是我的编码方式:

System.Net.Mail.SmtpClient objSmtpClient = null;

//uses the TLS port 587 with authentication
ServicePointManager.ServerCertificateValidationCallback = delegate (object s, System.Security.Cryptography.X509Certificates.X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; };
objSmtpClient = new System.Net.Mail.SmtpClient("email.host.com", 587);
objSmtpClient.UseDefaultCredentials = false;
objSmtpClient.Credentials = new NetworkCredential(userName, passWord);
objSmtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
objSmtpClient.EnableSsl = true;

根据这些事实,我想知道还有哪些其他方法可以对 .NET Framework 上的 Office 365 电子邮件服务进行身份验证并发送电子邮件?如果,

  1. 不支持 SMTP 协议(protocol)
  2. 不支持基本身份验证

引用文献: Can I send SMTP email through Office365 shared mailbox?

最佳答案

Microsoft Exchange online Docs说:

disabling SMTP AUTH in all tenants in which it's not being usedandSMTP AUTH will still be available when Basic authentication is permanently disabled on October 1, 2022andThe reason SMTP will still be available is that many multi-function devices such as printers and scanners can't be updated to use modern authentication. However, we strongly encourage customers to move away from using Basic authentication with SMTP AUTH when possible.

有 2 个 MailKit 问题讨论并显示了选项代码,当您在 m365 测试环境租户上禁用 SMTP 身份验证时,这些问题对您有用吗?

client.Authenticate (new SaslMechanismPlain ("username", "password"));

1:How can I implement service-to-service authentication with Office365 using the OAuth2 SASL mechanism?2:Office365 IMAP/POP basic auth retirement October 2020

您是否通过了此测试:'TestSaslInitialResponse'

关于c# - 从 Office 365 发送电子邮件不再支持基本身份验证和 SMTP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69459971/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com