How to Email Verification When Registration Complete Using Job Event & Listener in Laravel 5.* Programming

0
100

Today, I will try to explain and Coding Analysis how to add the email sending process to a queue to make Job app processes

Step 1:

Go to Laravel Project Directory In Terminal and Use Command to Make Auth System in Laravel Default

Step 2:

Setting up the Laravel Tables & Update Migration Table –
Open Database/Migration/ …create_users_table

Step 3:
Adding Some Table for Queues
These table will work for queued jobs and failed job. Go Terminal and run the following Artisan commands:

Now Configure Laravel Main Con fig File Called ( .env) Open and Place Bellow Code for Mailing System Configuration

You will Change using Your Own Information above like – MAIL_FROM_ADDRESS and MAIL_FROM_NAME
Step 4:
Creating Mail in Laravel System bellow –

Make also the SendVerficationEmail for Queue Job

Step 5: Now Open App\Email\EmailVerification.php and Write Code Update –

Again Work with App\Jobs\SendVerificationEmail.php and Write Code Update –

Update the User Model for New Registration Process:

Before getting started, Add If need More Field and also add ‘email_token’ in $fillable array in the User Model.

Now open RegisterController.php file (located inside the App/Controller/Auth folder).

Click the Link To Verify Your Email

Click the following link to verify your email {{ url(‘/verifyemail/’.$email_token)}}

@stop

Then Again –
Create a new file inside this folder with the name emailconfirm.blade.php.

Registration Confirmed

 

Your Email is successfully verified. Click here to login

 

 

 

@endsection

Then Another File –
Create a new file inside this folder with the name verification.blade.php.

Registration Confirmed

 

You have successfully registered. An email is sent to you for verification.

 

 

 

@endsection

Main Feature has been Done Yet! Welcome to Verification Script.
Final Step :
Add the following route in the routes\web.php file for user verification:

And
Testing the Email Verification Process in Own Server
At the command line, execute the following command to start listening for the queue.