This is working sample that i have tried :
Open your mail.php
under config
folder then fill with this option :
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.gmail.com'),
'port' => env('MAIL_PORT', 587),
'from' => ['address' =>'[email protected]', 'name' => 'Email_Subject'],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME','[email protected]'),
'password' => env('MAIL_PASSWORD','youremailpassword'),
'sendmail' => '/usr/sbin/sendmail -bs',
Open your .env
file under root
project. Also edit this file following above
option such
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=youremailusername
MAIL_PASSWORD=youremailpassword
MAIL_ENCRYPTION=tls
After that clear your config by running this command
php artisan config:cache
Restart your local server
Try visit your route with controller contains mail function at first
time it still error Authentication Required
. You need to login via
your gmail account to authorize untrusted connection. Visit this link
to authorize