首页 > 解决方案 > PHPMAILER 中的 TLS 和 STARTTLS

问题描述

我正在尝试从我的软件发送一封电子邮件,但它开始显示错误..它工作得很好,然后出现了这个错误..

我尝试过使用 SSL 和 TLS。我对此进行了很多搜索,但找不到任何东西。

require_once("phpmailer/class.phpmailer.php");
require_once("phpmailer/class.smtp.php");

$mail = new PHPMailer();
$mail->IsSMTP();

$mail->Host = "smtp.gmail.com";
$mail->Port = 587;
$mail->SMTPAutoTLS = true;
$mail->SMTPAuth = true;

我收到的错误消息是:

以下发件人地址失败:contato@allcomtelecom.com : MAIL not accepted from server,530,5.7.0 必须先发出 STARTTLS 命令。k24sm1975609oic.29 - gsmtp SMTP 服务器错误:5.7.0 必须先发出 STARTTLS 命令。k24sm1975609oic.29 - gsmtp

SMTP 服务器错误:5.7.0 必须先发出 STARTTLS 命令。k24sm1975609oic.29 - gsmtp

如果我使用 SSL

require_once("phpmailer/class.phpmailer.php");
require_once("phpmailer/class.smtp.php");

$mail = new PHPMailer();
$mail->IsSMTP();

$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
$mail->Host = 'smtp.gmail.com';
$mail->Port = 465;

我收到了这个错误:

以下发件人地址失败:contato@allcomtelecom.com:不接受来自服务器的邮件,530,5.5.1 需要身份验证。在 530 5.5.1 https://support.google.com/mail/?p=WantAuthError 198sm2326104oie.13 - gsmtp SMTP 服务器错误中了解更多信息:5.5.1 需要身份验证。在 530 5.5.1 https://support.google.com/mail/?p=WantAuthError 198sm2326104oie.13 - gsmtp了解更多信息

SMTP 服务器错误:5.5.1 需要验证。在 530 5.5.1 https://support.google.com/mail/?p=WantAuthError 198sm2326104oie.13 - gsmtp了解更多信息

标签: phpsmtpphpmailertls1.2starttls

解决方案


推荐阅读