Laravel Plain Text Send Mail Example

10-Apr-2023

.

Admin

Laravel Plain Text Send Mail Example

Hi Guys,

Today, In this example I would like to share with you how to send mail You can use the raw method to send the plain text in mail.

Here, Laravel 8 provides a mail class to send an email. you can use several drivers for sending email in laravel 8. you can use SMTP, Mailgun, Postmark, Amazon SES, and sendmail. you have to configure on env file what driver you want to use.

Here, I will give you a full example of laravel 8 we can use the raw method to send the plain text in the mail so follow mine below steps.

Solution:


routes/web.php

Route::get('email/plain-text', function(){

Mail::raw('This is the content of mail body', function($message) {

$message -> from('example@gmail.com', 'Nicesnippets Team');

$message -> to('example12@gmail.com');

$message -> subject('Nicesnippets.com');

});

dd('Send Email Successfully');

});

Now we are ready to run our example so run bellow command for quick run:

php artisan serve

http://localhost:8000/email/plain-text

Output

It will help you...

#Laravel 8

#Laravel 7

#Laravel

#Laravel 6