服务器上的 PHPMailer smtp 连接失败
PHPMailer smtp connection failed on server
我正在使用 PHPMailer class 从我的网站发送电子邮件,在本地它工作正常但在我的在线服务器上我收到错误:
2018-05-28 12:03:40 Connection: opening to ssl://smtp.gmail.com:465, timeout=300, options=array()
2018-05-28 12:03:40 Connection failed. Error #2: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages:error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed [/home/beesystems/public_html/specs/vendor/phpmailer/phpmailer/src/SMTP.php line 325]
2018-05-28 12:03:40 Connection failed. Error #2: stream_socket_client(): Failed to enable crypto [/home/beesystems/public_html/specs/vendor/phpmailer/phpmailer/src/SMTP.php line 325]
2018-05-28 12:03:40 Connection failed. Error #2: stream_socket_client(): unable to connect to ssl://smtp.gmail.com:465 (Unknown error) [/home/beesystems/public_html/specs/vendor/phpmailer/phpmailer/src/SMTP.php line 325]
2018-05-28 12:03:40 SMTP ERROR: Failed to connect to server: (0)
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
代码:
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
$mail->Username = \Yii::$app->params['mailer-account'];
$mail->Password = \Yii::$app->params['mailer-password'];
这是重要的部分:
SSL routines:ssl3_get_server_certificate:certificate verify failed
错误消息链接到的故障排除指南对此进行了广泛介绍,并且已在此处多次回答。在端口 587 上将 SMTPSecure
切换为 tls
无济于事。您的服务器很可能是 运行 旧版本的 PHP,或者具有过时的 CA 证书包。
我正在使用 PHPMailer class 从我的网站发送电子邮件,在本地它工作正常但在我的在线服务器上我收到错误:
2018-05-28 12:03:40 Connection: opening to ssl://smtp.gmail.com:465, timeout=300, options=array()
2018-05-28 12:03:40 Connection failed. Error #2: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages:error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed [/home/beesystems/public_html/specs/vendor/phpmailer/phpmailer/src/SMTP.php line 325]
2018-05-28 12:03:40 Connection failed. Error #2: stream_socket_client(): Failed to enable crypto [/home/beesystems/public_html/specs/vendor/phpmailer/phpmailer/src/SMTP.php line 325]
2018-05-28 12:03:40 Connection failed. Error #2: stream_socket_client(): unable to connect to ssl://smtp.gmail.com:465 (Unknown error) [/home/beesystems/public_html/specs/vendor/phpmailer/phpmailer/src/SMTP.php line 325]
2018-05-28 12:03:40 SMTP ERROR: Failed to connect to server: (0)
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
代码:
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
$mail->Username = \Yii::$app->params['mailer-account'];
$mail->Password = \Yii::$app->params['mailer-password'];
这是重要的部分:
SSL routines:ssl3_get_server_certificate:certificate verify failed
错误消息链接到的故障排除指南对此进行了广泛介绍,并且已在此处多次回答。在端口 587 上将 SMTPSecure
切换为 tls
无济于事。您的服务器很可能是 运行 旧版本的 PHP,或者具有过时的 CA 证书包。