Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel Gmail not working, "Username and Password not accepted. Learn more..."

Tags:

When I try to send an e-mail through my website running Laravel 4, I get this exception:

{"error":{"type":"Swift_TransportException","message":"Expected response code 250 but got code \"535\", with message \"535-5.7.8 Username and Password not accepted. Learn more at\r\n535 5.7.8 http:\/\/support.google.com\/mail\/bin\/answer.py?answer=14257 y70sm14744455qgd.3 - gsmtp\r\n\"","file":"\/var\/www\/vendor\/swiftmailer\/swiftmailer\/lib\/classes\/Swift\/Transport\/AbstractSmtpTransport.php","line":386}} 

Here is my mail config:

return array(   'driver' => 'smtp',   'host' => 'smtp.gmail.com',   'port' => 465,   'from' => array('address' => '[email protected]', 'name' => 'myname'),   'encryption' => 'ssl',   'username' => '[email protected]',   'password' => 'lol',   'sendmail' => '/usr/sbin/sendmail -bs',   'pretend' => false, ); 

I've tried the disable link i've found by googling this issue except it didn't make a difference.

Is there a way to tell Google "stop blocking this IP, it's me" ?

like image 666
user3817533 Avatar asked Aug 11 '14 17:08

user3817533


1 Answers

I tried the same thing and got the same error. So i personally checked my gmail account and i had a message from Gmail itself letting me know that they'd blocked an access attempt to my email account.

They showed an option to disable this security setting by visiting https://www.google.com/settings/security/lesssecureapps.

Things will actually be more straight forward if you visit that link already logged in into your Gmail account.

like image 176
Pathros Avatar answered Nov 14 '22 15:11

Pathros