ImZedi
ImZedi

Reputation: 294

Not Getting Email using Gmail smtp on live server Laravel

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.

Upvotes: 0

Views: 2539

Answers (2)

Kapitan Teemo
Kapitan Teemo

Reputation: 2164

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'),

Upvotes: 3

Md Riadul Islam
Md Riadul Islam

Reputation: 1471

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

Upvotes: 0

Related Questions