I am using Laravel 8. Trying to implement email notification and facing the below issue repeatedly. I have tried and changed the env file and mail.php file as suggested in different portals yet no luck.
Error: Swift_TransportException
Expected response code 250 but got code "530", with message "530 Error: authentication Required " http://localhost:8000/forgot-password
env file:
MAIL_DRIVER=smtp
MAIL_MAILER=smtp
MAIL_HOST=smtp-pulse.com
MAIL_PORT=587
MAIL_USERNAME=xxx.xxx@gmail.com
MAIL_PASSWORD=5mbE7LbBtcJc
MAIL_ENCRYPTION=TLS
MAIL_FROM_ADDRESS=xxx.xxx@gmail.com
MAIL_FROM_NAME="${APP_NAME}"
mail.php
<?php
return [
'default' => env('MAIL_MAILER', 'smtp'),
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'host' => env('MAIL_HOST', 'smtp-pulse.com'),
'port' => env('MAIL_PORT', 587),
'encryption' => env('MAIL_ENCRYPTION', 'TLS'),
'username' => env('xxx.xxx@gmail.com'),
'password' => env('5mbE7LbBtcJc'),
'timeout' => null,
'auth_mode' => null,
],
'ses' => [
'transport' => 'ses',
],
'mailgun' => [
'transport' => 'mailgun',
],
'postmark' => [
'transport' => 'postmark',
],
'sendmail' => [
'transport' => 'sendmail',
'path' => '/usr/sbin/sendmail -bs',
],
'log' => [
'transport' => 'log',
'channel' => env('MAIL_LOG_CHANNEL'),
],
'array' => [
'transport' => 'array',
],
],
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'xxx.xxx@gmail.com'),
'name' => env('MAIL_FROM_NAME', 'Company name'),
],
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
];
config should be liike this
In your code
'username' => env('xxx.xxx@gmail.com'),
'password' => env('5mbE7LbBtcJc'),
should be
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),