PHP - Swiftmailer using STARTTLS and self signed certificates

前端 未结 4 527
眼角桃花
眼角桃花 2020-12-05 11:32

I\'m trying to send an email with php and swiftmailer, using STARTTLS, but I\'m getting a certificate error. I have root access to the SMTP server, and the certificate used

4条回答
  •  余生分开走
    2020-12-05 11:38

    You do not need to edit /vendor files. You can specify (undocumented) options in your config/mail.php file:

    'stream' => [
        'ssl' => [
            'allow_self_signed' => true,
            'verify_peer' => false,
            'verify_peer_name' => false,
        ],
    ],
    

    You can check it yourself in vendor/laravel/framework/src/Illuminate/Mail/TransportManager.php on line ~50:

    ...
    if (isset($config['stream'])) {
        $transport->setStreamOptions($config['stream']);
    }
    ...
    

提交回复
热议问题