Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save jack2jm/742b928e8ccd02a8802f9ca4412bcecd to your computer and use it in GitHub Desktop.

Select an option

Save jack2jm/742b928e8ccd02a8802f9ca4412bcecd to your computer and use it in GitHub Desktop.
1. first login to your gmail account.
2. under Manage account > Sign In And Security > Sign In to google.
3. enable two step verification.
4. then you can generate app password.
5. you can use that app password in .env file.
----------------------------------------------
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=generate_app_password_from_security
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=sender_email_name
------------------------------------------------
Route::get('/test-email', function () {
try{
Mail::raw('Test Email!', function($message) {
$message->to('sent_to_email_id')->subject('Testing mails');
});
echo "Sent...";
}catch(Exception $e){
echo $e->getMessage();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment