我們使用PHPMailer。服務器被配置爲使用本地SMTP。 所以,一般的PHPMailer突擊隊看起來是這樣的:PHPMailer SMTP localhost,證書錯誤
$mail = new PHPMailer();
$mail->From = '[email protected]';
$mail->Host = 'localhost';
$mail->IsSMTP();
...
由於PHP5.6,這不工作了,因爲該證書不匹配。我們得到以下錯誤:
Warning: stream_socket_enable_crypto(): Peer certificate CN='*.thisvps.com' did not match expected CN='localhost' in /ho...PHPMailer_latest/class.smtp.php
我可以用抑制這種錯誤:
$this->smtpConnect([
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
]
]);
但是,是正確的路要走?我不是鎮壓錯誤的忠實粉絲;)。 或者在我們的配置中可能有錯誤?
版本信息: PHP 30年6月5日, 的PHPMailer:5.2.21
任何建議,歡迎,在此先感謝!
對於主機名(x.thisvps.nl),我已經爲SMTP連接安裝了證書,因爲在此之前,錯誤是根本沒有安裝證書。看看PHPmailer的調試信息,它看起來像是連接到x.thisvps.nl(可能通過將localhost翻譯成主機名或其他)。但沒有運氣..謝謝你的回答!我現在將禁用SMTP安全,因爲它是保存的。 – sanderbee