在 PHP 5.6 上使用 SMTP 的 PHP 邮件程序错误

标签 php email phpmailer

我在我的应用程序中使用 PHP Mailer 版本 5.2.1 一段时间了。它在没有安全 SMTP 的 PHP 5.4 中完美运行。

现在我一直在尝试将它与 PHP 5.6 版本一起使用,但 PHP Mailer 给我这个错误:

SMTP -> FROM SERVER:220 lbc6.cloud.netart ESMTP ready
SMTP -> FROM SERVER: 250-lbc6.cloud.netart 250-AUTH=PLAIN LOGIN 250-ENHANCEDSTATUSCODES 250-SIZE 1073741824 250-8BITMIME 250-AUTH PLAIN LOGIN 250 STARTTLS
SMTP -> FROM SERVER:220 2.0.0 Start TLS
SMTP -> FROM SERVER:
SMTP -> ERROR: RSET failed: 

不知道这是服务器错误还是应该更新 PHP Mailer。

编辑:-------------------------------------------------------- -------------------------------------------------- -----------------------

我已使用 Composer 将 PHP Mailer 更新到最新版本。现在我收到“无法连接到 SMTP 主机。”

PHP 邮件程序的错误也显示了这一点:

2017-01-19 10:51:25 SERVER -> CLIENT: 220 lbc6.cloud.netart ESMTP ready
2017-01-19 10:51:25 CLIENT -> SERVER: EHLO www.poligon4.webinkubator.pl
2017-01-19 10:51:25 SERVER -> CLIENT: 250-lbc6.cloud.netart 250-AUTH=PLAIN LOGIN 250-ENHANCEDSTATUSCODES 250-SIZE 1073741824 250-8BITMIME 250-AUTH PLAIN LOGIN 250 STARTTLS
2017-01-19 10:51:25 CLIENT -> SERVER: STARTTLS
2017-01-19 10:51:25 SERVER -> CLIENT: 220 2.0.0 Start TLS
2017-01-19 10:51:25 SMTP Error: Could not connect to SMTP host.
2017-01-19 10:51:25 CLIENT -> SERVER: QUIT
2017-01-19 10:51:25 SERVER -> CLIENT:
2017-01-19 10:51:25 SMTP ERROR: QUIT command failed:
2017-01-19 10:51:25 SMTP Error: Could not connect to SMTP host. 

我现在不知道该怎么办。

最佳答案

我找到了 PHP 5.6 问题的答案

这个版本的 SSL 证书非常严格,它阻止了我发送邮件的尝试。

Unitl我找出如何解决这个问题,我有临时解决方案:

$mail->SMTPOptions = array(
    'ssl' => array(
        'verify_peer' => false,
        'verify_peer_name' => false,
        'allow_self_signed' => true
    )
);

关于在 PHP 5.6 上使用 SMTP 的 PHP 邮件程序错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41736939/

相关文章:

PHP date() 作为 MySQL YEARWEEK()

php - 如何禁用 phpmailer 消息

php - "Notice: Undefined variable"、 "Notice: Undefined index"、 "Warning: Undefined array key"和 "Notice: Undefined offset"使用 PHP

java - 如何在不使用android中的上传按钮的情况下将图像上传到服务器

php - “跟随”或 'Subscribe' 方法

c# - 发送保存在磁盘上的 eml 文件

html - 在暗模式下控制 Gmail 中的颜色交换

javascript - 具有相同主题的 Gmail 邮件 - 删除除最新邮件之外的所有邮件

php - 如何在用 PHP 发送电子邮件之前验证 SMTP 凭据?

PHP 邮件程序 - SMTP GMAIL 身份验证