PHPMailer - OpenSSL Error

前端 未结 2 1192
无人及你
无人及你 2021-01-12 07:58

Based on the example that PHPMailer provides i have the script below,

date_default_timezone_set(\'Etc/UTC\');
require \'./PHPMailerAutoload.php\';
$mail = ne         


        
2条回答
  •  悲&欢浪女
    2021-01-12 08:35

    This is because you're running PHP 5.6 and it's verifying your certs, but your server is presenting invalid certs so it's failing. Both PHPMailer and PHP are correct in what they are doing - the code is not at fault. You can either fix your mail server, or do what it suggests in the troubleshooting guide, which is:

    $mail->SMTPOptions = array(
        'ssl' => array(
            'verify_peer' => false,
            'verify_peer_name' => false,
            'allow_self_signed' => true
        )
    );
    

    And as the guide says, you should not do this unless you have to - it's compromising your security.

提交回复
热议问题