Send Mail Example In Laravel 8

Websolutionstuff | Oct-16-2020 | Categories : Laravel

In this article, we will see send mail in laravel 8. here we will see how to send mail in laravel 8. Email is a very basic and important feature in the web development field and it is necessary for all clients to send and receive information and important data. So, in this tutorial, we will learn information about sending mail in laravel 8.

Laravel and SwiftMailer provide drivers for sending email via SMTP, Mailgun, Postmark, and Amazon SES. Also, you can send mail through local or cloud-based services.

So, let's see how to send mail in laravel 8.

Laravel 8 Mail - Laravel 8 Send Mail Example

Step 1: Setup DatabaseConfiguration

In this step we will set the configuration in the .env file for sending mail, here we are using SMTP and mailtrap.




Step 2: Create Mail Using Artisan Command

Laravel provides a built-in mail class for sending mail. So, we need to create testmail class for the same,

php artisan make:mail TestMail



namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;

class TestMail extends Mailable
    use Queueable, SerializesModels;

     * Create a new message instance.
     * @return void
    public function __construct()

     * Build the message.
     * @return $this
    public function build()
        return $this->view('mail.Test_mail');


Step 3: Create Blade File

Now, we will create a Test_mail.blade.php file.


Hi <br/>
This is Test Mail From Websolutionstuff. <br />
Thank you !!



Step 4: Create Send Mail Route

Now, Create a route for testing and send mail in laravel 8.



Step 5: Create EmailController

 Now create EmailController and add the below code.

public function testMail()
	$mail = '[email protected]';
	Mail::to($mail)->send(new TestMail);

	dd('Mail Send Successfully !!');






You might also like:

Recommended Post
Featured Post
Routing - Laravel 7/8 Routing Example
Routing - Laravel 7/8 Routing...

In this article, we will give you information about the basic route, named route, and advanced route in laravel 7 and la...

Read More


How to Send Bulk Mail Using Queue in Laravel 8
How to Send Bulk Mail Using Qu...

In this article, we will see how to send bulk mail using a queue in laravel 8. Laravel queue is used for sending bu...

Read More


Laravel Firebase Push Notification
Laravel Firebase Push Notifica...

In this example we will see laravel firebase push notification, firebase notification through you can notify u...

Read More


Laravel 9 Custom Helper Function Example
Laravel 9 Custom Helper Functi...

In this article, we will see laravel 9 custom helper function example. As we all know laravel provides many re...

Read More