0

Here is my Route.php

Route::get('invitations' , 'Invitationscontroller@accept');

Below is my Invitationscontroller.php

public function accept(){

        $email_id =  Users::select('email_id')->get();

        Mail::send('test' , array('user' => $email_id) , function ($message){

            $message -> to('[email protected]' ) -> subject ('Welcome!!!');
        });
        return "Success";
    }

I have configured mail.php as per requirements stated in tutorial.

When I run the URL, I get the error as

Swift_TransportException in AbstractSmtpTransport.php line 383: Expected response code 250 but got code "530", with message "530 5.7.1 Authentication required
"

Where m I missing something?

Thank you.

1 Answer 1

1

As the error message clearly says, you have a problem with the authentication towards your mail providers SMTP.

You need to configure your mail settings in your .env file, see sample data:

MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

Please check that you entered valid data.

Sign up to request clarification or add additional context in comments.

4 Comments

MAIL_DRIVER=smtp MAIL_HOST=smtp.gmail.com MAIL_PORT=587 MAIL_USERNAME=myusername MAIL_PASSWORD=mypassword MAIL_ENCRYPTION=tls
I have configured .env file with this input, still getting the same error.
Try if [email protected] works and refresh your Laravel cache afterwards with php artisan config:cache
Now it is showing this error. Expected response code 250 but got code "535", with message "535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/answer/14257 i20sm5418126pfj.91 - gsmtp "

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.