Laravel Send Emails Mailgun setup Tutorial

Today, We want to share with you Laravel Send Emails Mailgun setup Tutorial.In this post we will show you Mailgun setup with Laravel 5 example, hear for Emails with Laravel 5.7 Mailables we will give you demo and example for implement.In this post, we will learn about Send email in Laravel through email sending services with an example.

Laravel Send Emails Mailgun setup Tutorial

There are the Following The simple About Laravel Send Emails Mailgun setup Tutorial Full Information With Example and source code.

As I will cover this Post with live Working example to develop Laravel Send Emails Using PHP Mailgun , so the some How To Send Email In Laravel Tutorial for this example is following below.

  • Laravel configration(.env file)
  • Global Setting Of the Mailgun
  • Define Laravel Route
  • Create a Controller
  • Laravel Send Email Template View File

Sttep 1 : setting of the Laravel configration

open .env file and bellow code

add configration on mail Sending Emails with Laravel and Mailgun

[email protected]

Good, now I required to Include secret key as well as your domain of mailgun send mail api configration. Therefor I make a new account in offical website SignUp and then I registeration and active your simple step to mailgun new account as well as click on simple tabs Like Domails Into Add New Domail button.

Step 2 : Global Setting Of the Mailgun


And then We have to open Laravel services.php file as well as put here simple mailgun configration key and url this way :

 'mailgun' => array(
    'domain' => '',
    'secret' => 'key-225487c09e58-056a9e692c96dd832jd0cc',

Step 3 : Define Laravel Route


After I am step 3 ready to each client send mail for first welcome so first usnig laravel 5.4, 5.5, 5.6 and 5.7 make welcome route for email sending.

Also Read This ๐Ÿ‘‰   SET Limit length of a string truncate filter with AngularJS

Route::get('mail', '[email protected]');

Step 4 : Create a Controller


Good way, Then add simple send mail function in SendMailController.php file there for add Laravel this way :

public function mail()
    $client = Client::find(1)->toArray();
    Mail::send('emails.simpleSendMailTemplate', $client, function($message) use ($client) {
        $message->subject('Laravel Mailgun Testing');
    dd('Mail Send Successfully');

Laravel mailgun Send Mail
      try {
            $data = [
            $sent = Mail::send('emails.simpleSendMailTemplate', $data, function($message) {
                $message->from('[email protected]', 'Example Person');
                $message->to('[email protected]');
                $message->subject('Laravel Send Emails Mailgun setup Tutorial - Mailgun Testing');
            if( ! $sent) dd("something wrong");
            dd('Mail Send Successfully');
        catch (GenericHTTPError $e) {
           // return $e->getMessage();

Step 5 : Laravel Send Email Template View File


At Final step to make Laravel email template file for mailgun send mail therefor let’s make a simpleSendMailTemplate.blade.php file in emials folder.

<h1>Laravel Send Emails Mailgun setup Tutorial</h1>
Hi, I am from from mailgun testing.

Jaydeep Gondaliya

Angular 6 CRUD Operations Application Tutorials

Read :


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

I hope you get an idea about Laravel Send Emails Mailgun setup Tutorial.
I would like to have feedback on my 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.