Email Verification After User Registration In Laravel

How to verify user after registration?
In this blog post, we will learn how to implement email verification after user registration. We will implement this in three simple steps with the help of this post.
No matter if you have laravel/ui authentication or laravel/breeze authentication or any simple authentication you are using. In both authentication you just have to follow these steps.
Step #01: Create Or Open Laravel App:
  • Go to the user model App\Model\User.php

  • Implements MustVerifyEmail interface in User class

  • Include Destination
    use Illuminate\Contracts\Auth\MustVerifyEmail;
    Implements Interface
    class User extends Authenticatable implements MustVerifyEmail
    Step #02: Now let's assign middleware to the routes
    Middleware you have to assign is the **verified middleware**
    Route::get('/dashboard', function () {
        return view('dashboard');
    })->middleware(['auth','twofactor','verified'])>name('dashboard');
    Step # 03: Use Email Testing Tool
    You can use mailtrap.io or any email testing tool.
    1. First Create Your Inbox
  • Now, let's go to the smtp settings and copy laravel details..
  • Now, paste these details in your .env file
    MAIL_MAILER=smtp
    MAIL_HOST=smtp.mailtrap.io
    MAIL_PORT=2525
    MAIL_USERNAME=1e8ad4d5513cbb
    MAIL_PASSWORD=84a6b3c29196fc
    MAIL_ENCRYPTION=tls
    Also you have add your email from which you have registered to the mailtrap.
    MAIL_FROM_ADDRESS=youremail@email.com
    Now, Your application will have email verification service after user registration.
    If you follow all steps
    I hope this video will help you in implementing email verification in your laravel authentication.
    Thanks!

    59

    This website collects cookies to deliver better user experience

    Email Verification After User Registration In Laravel