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('[email protected]', 'Nicesnippets Team');
$message -> to('[email protected]');
$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...
- How to Notifications With database Driver in Laravel 11?
- How to Send Email Via Notification in Laravel 11?
- How to Install and Configure Laravel 11 Debugbar?
- How to Like Dislike System in Laravel 11?
- How to Paginate a Model with Relationship in Laravel 11?
- Laravel 11 Upload Files to Amazon S3 Example
- Laravel 11 Send WhatsApp Messages Example
- Laravel 11 Rest API Authentication Using JWT Tutorial