I can't get cakephp3 to send emails. In cakephp2 I could do this no problem. I am using the latest WAMP, and cakephp3.3 on Windows 7. I tried to follow the directions but it looks like I am getting something basic wrong. Do I also need to configure Wamp as I checked the php.ini
-development file but there is no smtp entry to change
error- 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 error)
controller
public function singleTutorEmail(){
$email = new Email();
$email->transport('gmail3');
$to='jjxxx@gmail.com';
$subject='testing';
$message='hello, dfsfsdfsdf sdfsdf';
$email->from(['jjxxx@gmail.com' => 'test'])
->to($to)
->subject( $subject)
->send($message);
}
in app.php
'EmailTransport' => [
'default' => [
'className' => 'Mail',
// The following keys are used in SMTP transports
'host' => 'localhost',
'port' => 465,
'timeout' => 30,
'username' => 'user',
'password' => 'secret',
'client' => null,
'tls' => null,
'url' => env('EMAIL_TRANSPORT_DEFAULT_URL', null),
],
'gmail3' => [
'className' => 'Smtp',
'host' => 'ssl://smtp.gmail.com',
'port' => 465,
'timeout' => 30,
'username' => 'jjxxx@gmail.com',
'password' => 'xxx',
'client' => null,
'context' => [
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
]
]
],
],
http://book.cakephp.org/3.0/en/core-libraries/email.html
Sending Mail using CakePHP 3.0