亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

PHP Mailer - 454 TLS 連接失敗

PHP Mailer - 454 TLS 連接失敗

PHP
收到一只叮咚 2023-03-11 17:23:04
在我的頁面上,我有一個使用 PHP Mailer 的聯系表格。一開始,僅出于測試目的,我將其與我的 Gmail 帳戶一起使用。一切都像一個魅力。然后我決定將電子郵件服務從 Gmail 更改為來自我的托管服務提供商的服務。然后問題就開始了。每次我嘗試發送電子郵件時,都會發生異常:2020-05-13 20:53:44 CLIENT -> SERVER: STARTTLS2020-05-13 20:53:44 SERVER -> CLIENT: 220 ready for tlsSMTP Error: Could not connect to SMTP host.2020-05-13 20:53:44 CLIENT -> SERVER: QUIT2020-05-13 20:53:44 SERVER -> CLIENT: 454 TLS connection failed: error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure (#4.3.0)2020-05-13 20:53:44 SMTP ERROR: QUIT command failed: 454 TLS connection failed: error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure (#4.3.0)這是我發送電子郵件的代碼:<?php    use PHPMailer\PHPMailer\PHPMailer;    use PHPMailer\PHPMailer\Exception;    use PHPMailer\PHPMailer\SMTP;    require 'PHPMailer.php';    require 'SMTP.php';    require 'Exception.php';    class Mailer    {        private $mail;        public function __construct($host, $user, $password, $port = 587)        {            $this->mail = new PHPMailer();            try            {                $this->mail->SMTPDebug = SMTP::DEBUG_SERVER;                  $this->mail->CharSet    = "UTF-8";                $this->mail->isSMTP();                $this->mail->Host       = $host;                $this->mail->SMTPAuth   = true;                $this->mail->SMTPSecure = 'ssl';                $this->mail->Username   = $user;                $this->mail->Password   = $password;                $this->mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;                $this->mail->Port       = $port;            }            catch(Exception $e)            {                echo "Exception: " . $e;            }        }我想我在 TLS/SSL 方面錯誤地配置了 PHP Mailer,因為我對此很新手。我的網頁使用 TLS 1.3 加密可能是一個權宜之計
查看完整描述

1 回答

?
青春有我

TA貢獻1784條經驗 獲得超8個贊

這是一個提示,如果有效,請不要忘記投票以加強。讓我們去設置...


$mail->SMTPOptions = array(

    'ssl' => array(

        'verify_peer' => false,

        'verify_peer_name' => false,

        'allow_self_signed' => false

    )

);

請記住,這是一種可以立即起作用的姑息解決方案,但我建議調查問題。另一個細節有時會使用端口 465 和 587 進行測試!


$mail->Port = "587";

$mail->SMTPSecure = "tls";

另一件事我不明白......為什么我要使用$ this->mail->SMTPSecure兩次?


 $this->mail->SMTPSecure = 'ssl';

 $this->mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;


查看完整回答
反對 回復 2023-03-11
  • 1 回答
  • 0 關注
  • 186 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號