Vranvs
Vranvs

Reputation: 1521

Laravel Mail to Log

I have my Laravel Mail driver setup as to print to my log file:

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

When I send mail, however, I am receiving a swiftmail authentication error:

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

vendor\\swiftmailer\\swiftmailer\\lib\\classes\\Swift\\Transport\\AbstractSmtpTransport.php

line 383\">AbstractSmtpTransport.php line 383

530 5.7.1 Authentication required

Is there another setting I need to set somewhere? Why is it trying to use swiftmailer?

Upvotes: 41

Views: 72936

Answers (4)

Serge
Serge

Reputation: 2187

This is in your mail.php config file...

When using

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

This will get the MAIL_DRIVER environment variable set in your .env file. In this case, 'log' is used only as a default if a value is not specified in your .env file... Your .env file probably has this still set in it... set it to log...

MAIL_DRIVER=smtp

replace with

MAIL_DRIVER=log

NOTE: For laravel >= 7.x MAIL_DRIVER replaced with MAIL_MAILER variable

Upvotes: 80

Bruce Tong
Bruce Tong

Reputation: 1431

If anyone encounters this error on L5.8 even after setting your mail driver to 'log' in the env file.

Swift_TransportException (530) Expected response code 250 but got code "530", with message "530 5.7.1 Authentication required "

You need to restart your web server, and restart "php artisan serve" as well. If it still doesn't work, you need to clear the configuration cache with php artisan config:clear

Upvotes: 3

iSWORD
iSWORD

Reputation: 808

One more reason why your MAIL_DRIVER=log configuration may not be working as expected is that you have your QUEUE_DRIVER set to something other than sync.

Thanks to the tip by gibex on Laracasts.

Upvotes: 5

Dmytro Balytskyi
Dmytro Balytskyi

Reputation: 51

Laravel use .ENV file!

Maybe your edit config\mail.php, try to make edits in the ENV file

Make dump the variable with your current mail configuration

Put this code in your controller

dd(config('mail'));

You will see the current settings that the system uses.

Upvotes: 4

Related Questions