How to Send Mail in PHP Laravel?

By Hardik Savani September 6, 2020 Category : Laravel

Laravel 5 provide several way to send email. You can also use core PHP method for send mail and you can also use some email service providers such as sendmail, smtp, mandrill, mailgun, mail, gmail etc. So you can choese any one and set configration. Laravel 5 provide Mail facade for mail send that have sevaral method for send email.In this example i going to show you how to send emails from gmail account example. This example is very simple you can use as requirement easily. It is very simple to configration with gmail account so first open your .env file and add bellow gmail configration.






Now we are ready to send mail for test so first create test route for email sending.


Route::get('mail', 'HomeController@mail');

Ok, now add mail function in HomeController.php file so add this way :


public function mail()


$user = User::find(1)->toArray();

Mail::send('emails.mailExample', $user, function($message) use ($user) {


$message->subject('E-Mail Example');


dd('Mail Send Successfully');


At last create email template file for send mail so let's create mailExample.blade.php file in emials folder.



Hello {{ $name }}, I am from

If you still found any error then follow this link : How to set gmail configration for mail in Laravel?.