Email notification when a new customer has been added

Stefan Bogdanescu
Founder & Senior Architect · 18 October 2026

Setting Up Automatic Email Notifications for New Customer Registrations in Laravel

As a store owner or developer working with the Laravel framework, you might find yourself wanting to send an automated email notification whenever a new customer registers on your site. This is not only useful for tracking customer growth but also ensures that you have up-to-date contact information for your registered users.

Understanding Email Notifications in Laravel

Laravel comes with built-in support for sending emails using the Illuminate\Mail namespace. It provides a simple and intuitive way to dispatch email notifications from within your application logic.

To begin, let’s set up our email configuration:

  1. First, ensure you have configured your config/mail.php file with the necessary SMTP details for your preferred email service provider (e.g., Gmail, Mailgun).
'from' => [
    'address' => env('MAIL_FROM_ADDRESS'),
    'name' => env('MAIL_FROM_NAME'),
],
  1. Next, you need to create a new mailable class that will define the content and structure of your email notification.

Create a new file at app/Mail/NewCustomerNotification.php:

<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;

class NewCustomerNotification extends Mailable implements ShouldQueue
{
    use Queueable, SerializesModels;

    public $customerName;

    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct($name)
    {
        $this->customerName = $name;
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this->subject('New Customer Registration')
            ->view('emails.new-customer-notification');
    }
}

In this example, we’re using Mailable to create a new email class. The constructor accepts the customer’s name, which is then accessible within our email view.

Dispatching Email Notifications on User Registration

Now that we have our mailable class set up, let’s modify the user registration process to dispatch an email notification when a new user is created.

Add the following code to your UserController@store method:

public function store(Request $request)
{
    // Validate and create the user...
    $validatedData = $validator->validate($request->all());
    $user = User::create([
        'name' => $validatedData['name'],
        'email' => $validatedData['email'],
        'password' => Hash::make($validatedData['password']),
    ]);

    // Dispatch the email notification
    Mail::to(config('app.contact_email'))->send(new NewCustomerNotification($user->name));

    return redirect()->route('customer.index')->with('success', 'New customer registered.');
}

In this example, we’re using Laravel’s built-in Mail facade to dispatch a new instance of our NewCustomerNotification class. The to method specifies the recipient email address, and the send method initiates the email sending process.

To ensure optimal performance, especially on busy systems, you can use queueing:

Mail::to(config('app.contact_email'))->queue(new NewCustomerNotification($user->name));

Customizing Email Templates with Blade

Finally, create a new Blade template file at resources/views/emails/new-customer-notification.blade.php to customize the content of your email notification:

@component('mail::message')

Hello,

A new customer has registered on our store!

Name: {{ $customerName }}

@endcomponent

This simple Blade template defines the body of your email and includes the customer’s name using the {{ }} syntax.

Conclusion

In this guide, we’ve demonstrated how to set up automatic email notifications for new customer registrations in Laravel without relying on any additional extensions or packages. By following these steps, you can create a seamless experience for your store administrators while keeping them informed about new customers joining your platform.

Remember to replace config('app.contact_email') with the actual contact email address where you want to receive the notifications.

Laravel’s documentation provides extensive details on sending emails and queuing tasks, which can further help you customize and optimize your email notification system.

Happy coding!

Our network