I trying to use laravel 4.1 mail function with xampp in windows OS. I am using gmail smtp to send the mail. but my mail fails with the following error:
stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed.
This is my mail.php:
return array(
'driver' => 'smtp',
'host' => 'smtp.gmail.com',
'port' => 587,
'from' => array('address' => 'mymail@gmail.com', 'name' => 'Title'),
'encryption' => 'tls',
'username' => 'myemail@gmail.com',
'password' => 'password',
//'sendmail' => '/usr/sbin/sendmail -bs',
'sendmail' => '\"C:\xampp\sendmail\sendmail.exe\" -t',
'pretend' => false,
Controller code:
public function sendEmail(){
try {
$mail = Mail::send('emails.users.welcome', array('firstname'=>Input::get('firstname')), function($message){
$message->to(Input::get('email'), Input::get('firstname').' '.Input::get('lastname'))->subject('Welcome to the Laravel 4 Auth App!');
});
return $mail;
}
catch (Exception $e) {
Log::error("UserController -> sendEmail() -> " . $e->getMessage()) ;
return "false";
}
}
Same problem. I solved it turning off TLS in .env and mail.php files
config/mail.php
'encryption' => 'tls'
.env
MAIL_ENCRYPTION=
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community