0

I want send smtp mail in laravel 5.2.20 in php But i am getting this error

 Whoops, looks like something went wrong. 1/1 Swift_TransportException in AbstractSmtpTransport.php line 383: Expected response code 250 but got code "530", with message "530-5.5.1 Authentication Required. Learn more at 530 5.5.1 https://support.google.com/mail/answer/14257 ra1sm17783395pab.24 - gsmtp " 

My config/mail.php file:

'driver' => env('MAIL_DRIVER', 'smtp'), 'host' => env('MAIL_HOST', 'smtp.gmail.com'), 'port' => env('MAIL_PORT', 587), 'from' => ['address' => '[email protected]', 'name' => 'example'], 'encryption' => env('MAIL_ENCRYPTION', 'tls'), 'username' => env('[email protected]'), 'password' => env('example_pwd'), 'sendmail' => '/usr/sbin/sendmail -bs', 

This is my laravel 5.2.20 framework mail.php but i don't update anything in my .env file. In my laravel framework Dotenv.php file is their but .env is not here. Which one i need to update....

My controller code is below here:

$user = Users::findOrFail($id); Mail::send('emails.reminder', ['user' => $user], function ($m) use ($user) { //echo "<pre>";print_r($user->email); //echo "<pre>";print_r($user->name); //exit; $m->from('[email protected]', 'Your Application'); $m->to($user->email, $user->name)->subject('Your Reminder!'); }); 

1 Answer 1

1

Ther error Authentication Required. You need to put your username and password for SMTP settings, put them in .env file if you dont have one create it

cp .env.example .env php artisan key:generate MAIL_DRIVER=smtp MAIL_HOST=your_SMTP HOST MAIL_PORT=YOUR SMTP PORT MAIL_USERNAME=USERNAME MAIL_PASSWORD=PASSWORD MAIL_ENCRYPTION=null 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.