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!'); });