Send Verification Email on Registration | Enable Registration mail in Laravel | Verify Email in Lara

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone welcome back do you know how to enable email on the registration when we are going to register our new user we want to send an email so let's get started we are in the level 9 and we are going to use the laravel ui package which is the use for authentication so i uh shoot it another video that how you can install the laravel gui so you can check out my video where i completely explained and you can also check out my videos uh laravel series i have eight plus series on the laravel and let's come to our topic our topic is how we can send an email verification so it comes with the comes default with the laravel but you need to enable this so let's go down and give it a read so here you need to add this implement must verify email so we are using the user model so let's go to the user model and here you need to add this so let me copy this and add this at the top and then i'm going to make this implement merge to verify so here space and enter this so now this is added and now we are open to use this now it's going to send an email when we are registering our new user so one more thing you need to do it i think it's mentioned or not let me check that is it mentioned in the documentation so go down and here you need to type no it's not mentioned in the documentation but you need to get this in the web.php file so here you need to go to the route and in the route you need to enable this verify equal to otherwise it will throw an error so first let's so let's get rid of this one and going i'm going to register a new user and then we are going to cut an error so what's the error so i'm going to shoot this in the live environment so you can understand that how to fix this issue if you happen if you had and happen this issue in the future so let me remove this user i already registered this user so i'm going to delete this one and then i'm going to make the password and let me make the same both for i registered this user and now it's throwing that verification dot verify not defined so here we need to enable this like this one so verify equal to so you need to make this true so then it's going not going to throw an error yes our issue is fixed so it's so email is sent or not so it's so by default it's going to send an email but it's not going to send an email why because let's give it a refresh why it's not sending an email because we did not configured our email credentials in the env file so let's go to the env file and here you need to update this env credential so let me update them behind the scene so copy this one paste and then close this one and now i'm going to register user again so here let me register it myself and password is one two eight and then click on this register so now it's going to send an email to us so give it a refresh give it a refresh here so it's so taking some time it's mean that it's sending an email and yes we are logged in as user and yes we also got an email this is our name of our laravel app and it's sending as hello please click below to logged in not login it's a verify email so if i go here and refresh it again so i'm not able to logged in anymore why it's logging me in so we need to first check that user is verified or not so how we can verify that so let's go to the if you have any other routes like in my case i have a home routes and i want to apply a user if user is user email is verified then i'm going to log in this user so this is the middleware which is verified which verify that user is verified or not so you need to type middleware and then verify it so comes by default with the laravel so it's very verified and if i give it a refresh so i forgot this so and then it's redirecting is me on this email verify so it's mean that i'm not i did not verified my email so give it a refresh so how it's checking that we are verified this email or not so it's checking from this field so you will verify it at so let's go to the email if i click on this email so it's going to verify this email so i'm not going to click on this because i lost this email and now i'm going to register i'm going to send an email again so let's click on this so it's going to by default send you once more email so let's go here and it's wait for a moment to complete this process and it's going to send an email and yes now it's saying that we a fresh verification link has been sent and yes we got this email and if i give it a refresh so we are not going to able to logged in but if i click on this verify email so then we are able to logged in okay so now it's redirected on the home so i'm closing this one and giving it refresh here so it's so allowing me to logged in great we successfully enabled this uh middleware for checking that user is verified or not and we also enable this verify so hope you got an idea how to send the by default which by default email which comes with the laravel so subscribe the youtube channel and stay connected for more upcoming updates so i will meet you in the next one bye
Info
Channel: Career Development Lab
Views: 32,326
Rating: undefined out of 5
Keywords: laravel, laravel course, laravel beginners course, laravel advance course, laravel with cdl, career development lab, cdl, laravel with hadi, laravel guide, https://cdlcell.com, cdlcell, laravel tips, lara tips, laravel tips and tricks, send verification email in laravel, how to send verification email in laravel, send verification email on registration, only registered user can login into the system, only verified users can login, send confirmation email to user, email verification
Id: XWTNSEM5yIc
Channel Id: undefined
Length: 6min 19sec (379 seconds)
Published: Wed Mar 02 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.