Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 5: Sending Email

I am trying to send an email in laravel application. Here is my .env file:

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=**********
MAIL_ENCRYPTION=tls

And here is the Mail::send method:

Mail::send('email', ['name' => "EE"], function($m){
            $m->to('[email protected]', 'Malik')->subject('Subjet of the email');
        });

And here is the error:

Swift_TransportException in AbstractSmtpTransport.php line 383: Expected response code 250 but got code "530", with message "530 5.7.0 Must issue a STARTTLS command first. s16sm7748968wib.16 - gsmtp"

Any help?

like image 727
Saani Avatar asked Jul 13 '15 08:07

Saani


1 Answers

Well, I got it. Infact the email was not authenticated because that email required a mobile phone authentication after login. changing to other email address that required just login credentials, it worked.

.env
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=yourpassword
MAIL_ENCRYPTION=tls
like image 57
Saani Avatar answered Oct 14 '22 16:10

Saani