0
votes

I am on Laravel 5.6 and my application working well. I am using Gmail SMTP for mail services.

here is my .env file.

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

I have already Turned ON Less secure apps in Gmail also turned ON 2 step verification.

From localhost, the mail system working like charm and I am getting all emails from Gmail SMTP.

But From Live Server, I am not getting any Emails and even there is no error popup.

My Host is a 000webhost free account because I am testing my Application.
so I read forums in 000webhost and change "SET MX RECORD " to "GOOGLE'S MX RECORD".

Now I am getting this error while sending any mail.

Expected response code 250 but got code "530", with message "530-5.5.1 Authentication Required. Learn more at 530 5.5.1 https://support.google.com/mail/?p=WantAuthError k142sm4568022ywa.67 - gsmtp "

Please help! Thanks in advance.

2
Please set MAIL_PASSWORD as GoogleAppPasswordAddWeb Solution Pvt Ltd
I have already set the password as GoogleAppPassword. In localhost, mail working fine but the problem is on the live server.ImZedi
Not sure, May be its your server problemZahid Hassan Shaikot
Does anybody know that 000webhost allow smtp for free account?ImZedi

2 Answers

3
votes

try changing your config/mail.php to your current credentials:

'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.gmail.com'),
'port' => env('MAIL_PORT', 587),
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME', '[email protected]'),
'password' => env('MAIL_PASSWORD', 'password'),
0
votes

Please allow access to less secure app from your google account following these steps:

  1. Go to your Google Account.
  2. On the left navigation panel, click Security.
  3. On the bottom of the page, in the Less secure app access panel, click Turn on access.

If you don't see this setting, your administrator might have turned off less secure app account access.

Google less secure app enable option