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.
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.
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.
Next, open your project's .env file and add the smtp settings provided by mailtrap.
4 - Test
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)