webman二进制打包后smtp发信失败

xy3

问题描述

用webman写了一个发信api,发现二进制打包前可以发信,打包后提示网络报错

报错信息

2023-10-11 14:05:14 Connection: opening to ssl://smtp.163.com:465, timeout=300, options=array()
2023-10-11 14:05:14 Connection failed. Error #2: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages:
error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed [phar:///www/wwwroot/mail.skyw.cc/build/webman.bin/vendor/phpmailer/phpmailer/src/SMTP.php line 397]
2023-10-11 14:05:14 Connection failed. Error #2: stream_socket_client(): Failed to enable crypto [phar:///www/wwwroot/mail.skyw.cc/build/webman.bin/vendor/phpmailer/phpmailer/src/SMTP.php line 397]
2023-10-11 14:05:14 Connection failed. Error #2: stream_socket_client(): Unable to connect to ssl://smtp.163.com:465 (Unknown error) [phar:///www/wwwroot/mail.skyw.cc/build/webman.bin/vendor/phpmailer/phpmailer/src/SMTP.php line 397]
2023-10-11 14:05:14 SMTP ERROR: Failed to connect to server: (0)
2023-10-11 14:05:14 SMTP Error: Could not connect to SMTP host. Failed to connect to server

截图报错信息里报错文件相关代码

打包前
打包后

操作系统及workerman/webman等框架组件具体版本

Centos 7
webman最新版

602 1 0
1个回答

胡桃

最好把代码也贴出来

  • jlman 2024-01-03
        $mail->SMTPOptions = array(
            'ssl' => array(
                'verify_peer' => false,
                'verify_peer_name' => false,
                'allow_self_signed' => true
            )
        );
  • leideqin 2024-01-09

    应该是证书的问题,去下载这个https://curl.se/ca/cacert.pem,改名放到/etc/ssl/certs/ca-certificates.crt,再试试就知道了

🔝