Posted inTechnology / Laravel / Mysql / Mysqli / php / Programming

Send Emails Using Laravel 6 Mailable Class?

Today, We want to share with you How To Send Emails Using Laravel 6 Mailable Class.In this post we will show you Laravel 6 Sending Emails Tutorial Example, hear for Send Email with Laravel 6 using Markdown Mailable Class we will give you demo and example for implement.In this post, we will learn about Sending Email, send email, send email in laravel 6, mail() Function with an example.

How To Send Emails Using Laravel 6 Mailable Class

There are the Following The simple About how to send email in laravel 6 example Full Information With Example and source code.

As I will cover this Post with live Working example to develop How to Send Mail using smtp in Laravel 6?, so the How To Laravel 6 Send Email Tutorial And Example is used for this example is following below.

Laravel 6 Supports an API with driver support for SMTP, PHP Laravel 6 SendMail, using Mailgun, using Sendgrid, Mandrill, using Amazon SES, SpartPost, or More.

Step 1: Change Simple Send Mail Configuration

.env

add send Email configuration with mail driver, mail host Name, mail port, mail username, mail security password

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=Example#4549865
MAIL_ENCRYPTION=tls

Step 2: Create Mail

php artisan make:mail SendMail

app/Mail/SendMail.php

userInfo = $userInfo;
    }
   
    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this->subject('Good Latest Testing for Mail from tamilRokersDemo.com')
                    ->view('emails.sendEmail');
    }
}

Step 3: Create Blade View

resources/views/emails/sendEmail.blade.php




    tamilRokersDemo.com


    

{{ $userInfo['title'] }}

{{ $userInfo['body'] }}

Thank you, {{ $userInfo->user_name }}

Step 4: Define a Laravel 6 Route

routes/web.php

Route::get('sendmail', function () {
   
    $userInfo = [
        'title' => 'PHP Laravel 6 Send Email Example - for Testing Purpose',
        'body' => 'This is a email demo from TamilRokers jio 2020 to 2025',
        'user_name' => 'Virat Kohali'
    ];
   
    \Mail::to('[email protected]')->send(new \App\Mail\SendMail($userInfo));
   
    Session::flash('success', trans('messages.MailSendSuccess'));
    return redirect('mail');
});
Web Programming Tutorials Example with Demo

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about laravel 6 send mail example smtp.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.

Leave a Reply

Your email address will not be published. Required fields are marked *

We accept paid guest Posting on our Site : Guest Post Chat with Us On Skype