When I try to send an e-mail through my website running Laravel 4, I get this exception:
{\"error\":{\"type\":\"Swift_TransportException\",\"message\":\"Expe
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.
I had lot of issues finding answer for this. Then after doing lot of trial and error i have found an solution to this. Most of the solution above worked for other but it help me upto 50%.
So, This is how it worked for me (100%):
Next in laravel, Goto .env file and change
MAIL_USERNAME= 'App Name you created'
MAIL_PASSWORD= 'Generated Password for that app'
This should be able to send emails from your gmail account. Please leave a comment if it doesn't works for you.
https://www.google.com/settings/security/lesssecureapps and active it. https://accounts.google.com/b/0/DisplayUnlockCaptcha and active it.
'port' => env('MAIL_PORT', 587), <br>
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
Try this:
I know this doesn't answer your question... but I would say don't use gmail for SMTP sending.
Use a service like mandrill/mailgun... IE a service that is made for this type of thing. See my mandrill setup here:
http://laravel.io/forum/07-06-2014-mail-with-mandrill-doesnt-work?page=1#reply-10154
Mandrill gives you 12k emails free per month.
Go to this link and disable unlock Captcha https://accounts.google.com/b/0/DisplayUnlockCaptcha