Laravel 8 Tutorial - Send Email using Gmail

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi everyone welcome back to the laravel air tutorial in this video we are going to learn about how to send email using gmail in laravel it so first of all let's create a new controller so switch to the command prompt and here just type the command php artisan make colon controller a space controller name let's say controller name is mail controller okay now press enter now let's create a mail class so just right here php artisan make mail a space uh mail class name let's say mail class name is test mail okay now press enter now switch to the project and make configuration for email id so just go inside the env file and here just add the mail post so just write here smtp dot google mail.com okay mailport mailport465 and main username so just add here the gmail user id so go to this email and just copy this gmail id and list here now add the password so just write here password all right and mail encryption ssl all right and here i'm just going to use same email id in from address so just paste here same email id okay now save this file and go to the gmail and here just click on this icon then click on account now just click on security tab and then install the page and from here make less secure app access on okay i have already done this all right so now switch to the command prompt and here just run the application so just right here php artisan present now switch to the project and just go to the app and http controllers and from here just open mail controller okay and inside this mail controller let's create a function so just write here public function and function name let's say function name is send email okay and inside this create an array variable so just write here details and inside this array just pass title and add the title here mail home serve side media okay and at your body inside body just type here the message this is for testing testing name all right now here just use the mail so just write your mail okay and also add here use illuminate support uh facade mail okay now here just use mail colon colon two and here just add the recipient email id so just go to the dot enb file and here just copy this email id because i am i am going to use same email id okay as a recipient so just add here and now arrow function arrow and just add here send new testament class okay just write your text mail and also add here use that mail test mail okay and inside this just pass here this area okay so just copy and paste here all right and simply return here return email sent all right now save this file and let's create a route for this function so go to the web.php file so just open routes and let's open wave.php and here let's create a new route so just right here route okay add the uri send that email okay add the controller name which is mail controller okay then column column class all right and also add here this one use app http controllers mail controller okay now just add here the function name function name is send mail so just copy this function and paste here all right now save this file now go to the app directory then mail and just open test mail okay and here let's create a variable public variables just right here public dollar details okay and inside this constructor say the argument details and now assign this detail details to this detail okay so just write here this download this okay arrow v s is equal to this one dollar detail okay and inside this build function just write here this and add here the subject so just write your subject and inside this right here any subject i'm just going to write here test okay and here just add the view emails dot test mail okay now save this file and let's create this view so just copy this and go to the resources directory then views inside this just let's create a new folder folder name emails okay and inside this image create a new file and let's say file name is test mail dot blade dot php okay this one test mail dot dot php now just open this file and here just add html5 boiler update so just type exclamation sign and press tab now change the title let's say test mail okay and inside this body just right here h1 tag double curly bracket dollar this variable just copy and paste here and inside this just right here title okay this item so let's write here title now here just add the b tag and inside this dollar details okay add here body okay and in last step here thank you okay now save this file okay all set now let's check sources to the browser and here just go to the url send email okay now press enter uh okay spelling mistake so just go inside the test mail.php file and here will not be subject okay now save this file and try to redone so refresh the page and you can see here the message email sent okay now go to the gmail and you can see here the mail okay just open this mail and you can see here the title and the message okay and here you can see the sender message a sender email id and two okay so in this way you can send email using gmail in laravel it so that's all about sending email using gmail so thanks for watching this video and if you still have any kind of question you can ask me in the comment box don't forget to subscribe my channel thanks for watching
Info
Channel: Surfside Media
Views: 33,751
Rating: undefined out of 5
Keywords: How, to, Program, laravel (Software), laravel, laravel v8, laravel 8, laravel project, laravel setting up, laravel v8 setting up, laravel v8.0, v8.0, laravel 8.0, laravel 8 playlist, laravel 8 tutorial, laravel 8 lesson, laravel 8 introduction, intro to laravel 8, laravel tutorial, laravel 8.0 tutorial for beginners, laravel for beginners, laravel tutorial for beginners, sending email, email, sending email using gmail in laravel 8, laravel 8 email, mail, laravel8 email, smtp
Id: kWEvrHVg8kI
Channel Id: undefined
Length: 11min 36sec (696 seconds)
Published: Wed Sep 09 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.