【问题标题】:System.Net.Mail.SmtpException: 'The SMTP server requires a secure connection or The server response was: #5.7.0 Must issue a STARTTLS command first'System.Net.Mail.SmtpException:“SMTP 服务器需要安全连接或服务器响应为:#5.7.0 必须首先发出 STARTTLS 命令”
【发布时间】:2021-01-04 03:56:01
【问题描述】:

这个错误的解决办法是什么。

System.Net.Mail.SmtpException: 'The SMTP server requires a secure connection or The server response was: #5.7.0 Must issue a STARTTLS command first'

使用(var smtpclient = new CvxSmtpClient("username", "password", 587))

                        message.Body = email.message;
                        smtpclient.EnableSsl = false;
                        smtpclient.Send(message);                           
                        var param = new SqlParameter();
                        param.ParameterName = "@id";
                        param.Value = email.id;
                        db.ExecuteSql(queryUpdateEmailsToSend, param);

【问题讨论】:

标签: c# outlook smtp


【解决方案1】:

SMTP 服务器拒绝不安全的连接。

您设置了smtpclient.EnableSsl = false,因此SmtpClient 不使用SSL。尝试将其设置为true

有关更多详细信息,请查看文档:SmtpClient.EnableSsl Property

【讨论】:

  • 即使在设置 smtpclient.EnableSsl = true 之后。我在 system.net.mail.mailcommand.checkResponse(SmtpStatusCode StatusCode, String response)\r\n 在 system.net.mail.mailcommand.Send(SmtpConnection conn, 处收到此错误“系统”
  • @ReshimmaPasupathi 将新错误添加到您的问题中,因为它似乎不适合评论并在您处理初始问题时解决问题。另外,请正确格式化您的内容。阅读Markdown help
猜你喜欢
  • 2011-07-13
  • 2014-06-27
  • 2013-07-02
  • 2016-05-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-02-17
  • 2013-02-13
相关资源
最近更新 更多