-->

Laravel - Sendgrid smtp error “550 Unauthenticated

2020-04-21 08:25发布

问题:

I am following Sendgrid laravel integration using smtp to send email.

I did as the documentation says, all credentials are same as my sendgrid credentials.

But whenever I try to send email using,

Mail::send('mails.demo', $data, function($message)
        {
            $message->to('test@gmail.com', 'test')->subject('This is a test mail!');
        });

It shows error as

Swift_TransportException in AbstractSmtpTransport.php line 383:
Expected response code 250 but got code "550", with message "550 Unauthenticated senders not allowed
"

I can send email using sendgrid test using Telnet guide, that works perfectly.

回答1:

"550 Unauthenticated senders not allowed" explicitly means that you're system is not attempting to Authenticate. So you're not actually sending your credentials through. You should review your Laravel configuration, and make sure that it will send the AUTH command before sending the MAIL FROM: command.



回答2:

I have faced same issue in my team and once I check with developer, developer added sendgrid credentials both in .env file and config/mail.php file.

May be same issue happening there, if so revert the config/mail.php with the one created in laravel installation.