Laravel Swiftmailer:Expected Response Code 250 But Got Code "530", with Message "530-5.5.1 Authentication Required

Laravel SwiftMailer : Expected response code 250 but got code 530, with message 530-5.5.1 Authentication Required

Try to turn on "less secure apps" of your account on this page. Read this google answer.

Laravel 5.5 Expected response code 250 but got code 530

I' may suggest you use this as well, it worked for me,

Please Note if you're using Gmail: create a gmail app password, but be sure to your 2 Step verification set up, from sign in and securiity, the following link: https://myaccount.google.com/apppasswords to setup app password,
use that and follow procedure 2 after this return to set up gmail with smtp.

please note: code down below are for mail.php file

(do not forget to use: php artisan config:cache)
after changes to .env file as well

return [

'driver' => env('MAIL_DRIVER', 'smtp'),

'host' => env('MAIL_HOST', 'smtp.mailtrap.io'),

'port' => env('MAIL_PORT', 2525),

'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'lxxxx@xxxx.com'),
'name' => env('MAIL_FROM_NAME', 'myMail'),
],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),

'username' => env('MAIL_USERNAME'),//this setting in .env only leave as is here

'password' => env('MAIL_PASSWORD'),//this setting in .env only leave as is here

'sendmail' => '/usr/sbin/sendmail -bs',

'stream' => [
'ssl' => [
'allow_self_signed' => true,
'verify_peer' => false,
'verify_peer_name' => false,
],
],

'markdown' => [
'theme' => 'default',

'paths' => [
resource_path('views/vendor/mail'),
],
],
];

//procedure 2 for gmail
return [

'driver' => env('MAIL_DRIVER', 'smtp'),

'host' => env('MAIL_HOST', 'smtp.gmail.com'),

'port' => env('MAIL_PORT', 587),

'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'lxxxx@gmail.com'),
'name' => env('MAIL_FROM_NAME', 'myMail'),
],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),

'username' => env('MAIL_USERNAME'),//this setting in .env only leave as is here

'password' => env('MAIL_PASSWORD'),//this setting in .env only (use app password you created for gmail and PLEASE leave as is here

'sendmail' => '/usr/sbin/sendmail -bs',

'stream' => [
'ssl' => [
'allow_self_signed' => true,
'verify_peer' => false,
'verify_peer_name' => false,
],
],

'markdown' => [
'theme' => 'default',

'paths' => [
resource_path('views/vendor/mail'),
],
],
];

Hope it helps.
Kind regards

Laravel cant send mail: Expected response code 250 but got code 530, with message 530 5.7.1 Authentication required ↵

1.change mail driver

MAIL_DRIVER=sendmail
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=mymail@gmail.com
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls

2.clear config cache

php artisan config:clear

Expected response code 250 but got code 530, with message 530 5.7.1 Authentication required

your mail.php on config you declare host as smtp.mailgun.org and port is 587 while on env is different. you need to change your mail.php to

'host' => env('MAIL_HOST', 'mailtrap.io'),
'port' => env('MAIL_PORT', 2525),

if you desire to use mailtrap.Then run

php artisan config:cache

laravel Expected response code 250 but got code 530

you need to enable your 2 step verification from gmail account.

https://myaccount.google.com/security

then use the generated key from there to your ENV_PASSWORD instead your real password.



Related Topics



Leave a reply



Submit