Laravel Create Newsletter Example Tutorial

Admin   Laravel   669  2021-03-15 15:00:08

Hi Guys,

In this tutorial,I will learn you how to use newsletter in can easy and simply use newsletter in laravel.

Step 1 : Install Laravel App

In this step, You can install laravel fresh app. So open terminal and put the bellow command.


composer create-project --prefer-dist laravel/laravel blog

Step 2 : Setup Database Configuration

After successfully install laravel app thenafter configure databse setup. We will open ".env" file and change the database name, username and password in the env file.








Step 3: Install Newsletter Package

In this step,you can install newsletters in command terminal.bellow this command.


composer require spatie/laravel-newsletter

The package will automatically register itself.

To publish the config file to config/newsletter.php run:


php artisan vendor:publish --provider="Spatie\Newsletter\NewsletterServiceProvider"

Step 4: Sign Up in MailChimp Get MailChimp API Key And List Id

Now, you sign up in MailChimp from If you have already account then sign in. After successfully sign up or sign we can get api key and list id from mailchimp

Step 5: SignSet MailChimp API Key And List Id in .env file

Next, we need to update the Mailchimp API key and list id in.env file:




Step 6: Create Route

now, we need to add for NewsletterController in laravel application. so open your "routes/web.php" file and add following route.



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

Route::post('newsletter/store','[email protected]');

Step 7: Create Controler

Here this step now we should create new controller as NewsletterController. So run bellow command and create new controller.


php artisan make:controller NewsletterController

successfully run above command then,you can create method for get courses and fetch record students table. So Let's copy bellow and put in the controller file.




namespace App\Http\Controllers;

use Illuminate\Http\Request;

use Newsletter;

class NewsletterController extends Controller


public function index()


return view('newsletter');


public function store(Request $request)


if ( ! Newsletter::isSubscribed($request->email) )



return redirect('newsletter')->with('success', 'Thanks For Subscribe');


return redirect('newsletter')->with('failure', 'Sorry! You have already subscribed ');



Step 8: Create Blade File

In this step,you can create to layout in this blade file.