我们使用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