php - 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了解更多信息
解决方案
推荐阅读
- react-native - 如何在 React-Native 中使用 Twemoji?
- rest - 对于spring boot rest webservices中的任何请求,如何在给定时间后取消进程并返回失败响应?
- mybatis - 如何通过 mybatis 生成器中的配置使用 updateByPrimaryKeySelective 设置 null
- flutter - Flutter 中 Firestore 事务的错误处理
- c - printf() 函数异常
- grpc - 如何在自己的 Yocto 包中访问 protoc 编译器并引用 gRPC 库
- javascript - jQuery - 通过公共属性检查对象是否在集合之间匹配
- javascript - 如何使用 html/javascript 加载相同的 html 但具有不同的数据和不同的 url?
- python - 如何获得满足条件的数字元组?
- mysql - Laravel 如何与数据库交互