Laravel 7 Send Email Example Tutorial




In this laravel send mail/email tutorial. You will learn how to configure email smtp detail and send mails/emails.

Laravel has supported many API and drivers like SMTP, SendMail, Mailgun, Sendgrid, Mandrill, Amazon SES, SmartPost, Gmail etc for send mail/email for laravel web applications.

When you are working with Laravel web application. So you have to send mail to users in many ways. Like sometimes the user has to send email verification email. Or send an invoice in the mail. Or other types of information need to be sent in email.

Laravel Send Email/Mail

  • Setup SMTP Credentials in .env
  • Create Controller with Method
  • Create Route & Blade View
  • Email Send and Test

Setup SMTP Credentials in .env

This is the first step, go to .env file and set SMTP details in .env file.

You could do like:

MAIL_USERNAME=Add your user name here
MAIL_PASSWORD=Add your password here

The above email SMTP details are default and necessary. You can also set the following things:


The above are used by Laravel web applications when you will send emails/mails to users. The from email address and name part of the email that is displayed to users.

Create Controller with Method

This is the second step. in this step, we will create a controller for sending emails/mails.

Just open your command prompt (CMD) and go to your project root directory. Then type the below command for creating a new controller.

php artisan make:controller MailController

After that, You need to create one method in your controller. So go to the => app/Http/Controllers/MailController.php And update the below given code into your controller:

namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Redirect,Response,DB,Config;
use Mail;
class MailController extends Controller
    public function sendEmail()
        $data['title'] = "This is first mail from";
        Mail::send('', $data, function($message) {
            $message->to('[email protected]', 'Receiver Name')
        if (Mail::failures()) {
           return response()->Fail('Sorry! Please try again latter');
           return response()->success('Great! Successfully send in your mail');

Create Route & Blade View

Next step, here you need to create one route and one blade view file.

So go to routes/web.php and update the following route in your file:

Route::get('lara-email-send', '[email protected]');

After that, go to your resources/views/ and create a new blade view file name email.blade.php and update the below code into your file:

<h1>{{ $title }}</h1>
<p>This is my first Email using Laravel Application</p>

Email Send And Test

Hit the following URL in your browser and test:


If you are not run PHP artisan server command, direct go to your browser and type the URL



This tutorial idea has taken from the following urls: