DEV Community

Cover image for How to Send Verification Email after Registration in Laravel with Jetstream .
Kepson Diaz
Kepson Diaz

Posted on

How to Send Verification Email after Registration in Laravel with Jetstream .

In Laravel sending a verification email with Jetstream after registration is the easiest thing to set up.

To get started you need to install the Jetstream package.
You can follow all jetstream installation here : https://jetstream.laravel.com/installation.html

After the installation of JetStream to enable sending mail verification after user registration :

1- Enable Jetstream EmailVerification feature

you should enable email verification by uncommentting emailVerification feature on the fortify.php file.
in our image, this is the line : 137.
Image description

2 - Add MustVerifyEmail to Your User model

after enabling email verification you need to add MustVerifyEmail interface to the user's model file.
MustVerifyEmail is an interface that provide sendEmailVerificationNotification function and many others.

Image description

3 - Setup Mailtrap

For tesing email verification we gonna use Mailtrap.
Mailtrap is a service that provides a simulated SMTP server for testing email sending in development and staging environments.
First, register in the https://mailtrap.io to create a new account (It has a free version so don’t worry), and after the registration success, you can see the SMTP Setting for integrating your Mailtrap into our Laravel project.

Image description

Next, open your project's .env file and add the smtp settings provided by mailtrap.

Image description

4 - Test

  • Registration user test :
    Image description

  • An verification email is sent to user test
    Image description

  • Email Veirification
    Image description

Is the end of this article. If you have any suggestions for improving this article, please let us know in the comments.

Top comments (0)