小编hug*_*ug0的帖子

Cakephp 3尝试使用Gmail发送电子邮件时出错

我正在尝试使用Gmail发送验证邮件但是我收到此错误:

stream_socket_client():SSL操作失败,代码为1. OpenSSL错误消息:错误:14090086:SSL例程:SSL3_GET_SERVER_CERTIFICATE:证书验证失败stream_socket_client():无法启用crypto stream_socket_client():无法连接到ssl://smtp.gmail .com:465(未知错误)

我已按照配置传输指南.

Email::configTransport('gmail', [
  'host' => 'ssl://smtp.gmail.com',
  //'host' => 'smtp.gmail.com',
  'port' => 465,
  'username' => 'user@gmail.com',
  'password' => 'password',
  'className' => 'Smtp',
  'log'=>true,
  //'tls' => true
]); 

$correo = new Email();
$correo
  ->transport('gmail')
  ->template('registro_exito')
  ->emailFormat('html')
  ->to('email@gmail.com')
  ->from('another_email@gmail.com')
  ->viewVars([
    'nombre_sitio_secundario'=>$nombre_sitio_secundario,
    'usuario_id'=>$usuario_id,
    'token'=>$token
  ])
  ->send(); 
Run Code Online (Sandbox Code Playgroud)

这是完整的错误日志:

2015-09-24 20:09:39 Error: [Cake\Network\Exception\SocketException] stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
stream_socket_client(): Failed to enable crypto
stream_socket_client(): unable to connect to ssl://smtp.gmail.com:465 (Unknown …
Run Code Online (Sandbox Code Playgroud)

php email ssl gmail cakephp-3.0

6
推荐指数
1
解决办法
5300
查看次数

标签 统计

cakephp-3.0 ×1

email ×1

gmail ×1

php ×1

ssl ×1