I am using cakephp 3.0. I am trying to send mail using cakephp through gmail SMTP Server. I am trying to do it from my localhost so I don't have ssl. This is the configuration I've done in app.php:
'EmailTransport' => [
'gmail'=>[
'className'=>'Smtp',
'host'=>'smtp.gmail.com',
'port'=>587,
'timeout' => 60,
'username'=>'myemail@gmail.com',
'password'=>'mypassword',
'tls' => true,
]
]
This is where I've created my email profile :
'Email' => [
'gmail' => [
'transport' => 'gmail',
'from' => 'myemail@gmail.com'
]
],
This is the code from my custom mailer class :
$mail
->to($email)
->profile('gmail')
->subject($this->subject)
->emailFormat('html')
->template('welcome')
->viewVars([
$name=>$name,
$code=>$code
]);
I've already allowed access to less secure apps in my gmail account. This is the error cakephp is throwing :
SMTP server did not accept the connection or trying to connect to non TLS SMTP server using TLS
Attaching a complete snapshot of the error :