hey i cant find where to get the code
send emails with laravel and google gmail smtp SSL
After spending a day trying to make google Gmail send and email finally I achieved it and I want to share the way and codes I use to make it happen... maybe you are trying to make the same
• On the .env file
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
[email protected]
MAIL_PASSWORD=this code is generated read more down
MAIL_ENCRYPTION=ssl
[email protected]
MAIL_FROM_NAME=yourName
MAIL_LOG_CHANNEL=NULL
• On the mail.php
return [
'driver' => env('MAIL_DRIVER'),
'host' => env('MAIL_HOST'),
'port' => env('MAIL_PORT'),
'from' => [
'address' => env('MAIL_FROM_ADDRESS'),
'name' => env('MAIL_FROM_NAME'),
],
'encryption' => env('MAIL_ENCRYPTION'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'sendmail' => '/usr/sbin/sendmail -bs',
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
'log_channel' => env('MAIL_LOG_CHANNEL'),
];
• I add this code on the file that calls the /Mail::To() ON THE TOP I don't know if that is useful but I just added and all is working so I will not remove it... Just in case it's needed
use Illuminate\Support\Facades\Mail;
• Okay that's it for the code now you must
- Enter your Google account
- go to account -> security
- then fill up the two-ways authentication to google
- After doing all that you must GENERATE AN APP CODE
- on the same security tap, you will find something called APP Password enter and generate one.
- with that code COPY and PASTE IT on the .env file
MAIL_PASSWORD= HERE!!
that code allows you to send emails with google GMAIL
hope someone reaches this post and be useful for the Laravel community and Laracast too
• Santino codex / If this helps you leave me a comment :)
Please or to participate in this conversation.