How to Send an Email with NodeMailer in NestJs

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Hello friends welcome back to the new tutorial of the nest.js tutorials today we are going to learn how to send emails via Nest GS using the node mailer so those who haven't subscribed my channel yet please do subscribe my channel and if you like the video please do like share and comment on my video so let's get started so first of all go to the directory HTML and my project is basically Nest folder so here we need to create a new project okay so for that one we need to add the command like nisk I want to create a new project with the name email or you can say mail okay next we'll create that uh yeah npm okay this is installation is in progress okay moving to the next step we have to install these two dependencies that is nest.js modules mailer node Miller okay so these two required so we need to install this one so after completion of that one [Music] so it's done so go to the directory first CD mail okay so we are on the directory right now so let's install this stuff these two node mailer we have to install the npm package so install this one also so this is installed okay so let's go step by step the things okay so here we need to go with the we have to use this one so after this first of all we have to configure the app module.ts part right so this is app module dot yes we need to copy this and go to our app module.ps file so let me go with opening with this core editor okay so here we have the source we have a app module.ts so here we have to add our logic so here you can see that so male controller we haven't used and the mail service we are not using is so remove this one okay so controllers mail controller we don't require it right now a mail service we are not using okay so this is not necess modules mailer okay so here we are importing that module with the transport we here you know to pass the host and these are the user credentials you need to pass it over here right so you can add it over here okay so here we have a controller that is app controller I am using and provider is app service okay so this is the basic of the app module.ps moving to the next we are using the after this we need the controller right so here we need to create a function so let's create that function also so here we have the controller code this is service part okay this is controller app controller so I'm going to copy this and add this over here okay so paste this send mail function in app service it's not created right so you need to create this animal function over here so here we go with the send mail function so let me copy and paste this one okay so copy and paste go to the app service and here we need to create a send email function now the error gone so you can see that send mail function so here we have the two from subject test and this so here I am going to just add my email address right now or any test email message .com and here also I can add rajini and here we can see that rajini 901 Pawn at the rate millinator.com millinator.com okay so this is a basic HTML file that is bold welcome to the uh sending sending email email via Nest JS node Miller right so we have added this one HTML so send mail function this is a mailer service which we have added using the nest.js module mailer okay mail a service and this is a send mail function this is app controller where we are this dot app service because in app service we have a function send a mail right so you have to include this one so controller then we have a service then in the main module we have include the SMTP Imports right so this is done everything is done sorted and we have already configured the user and the password the host service is okay so let's run and check so next start by default route is basically slash okay app controller by default slash so we are going to hit that one and we have to open the which email address we have added rajini 90.com so we have to open the regime 90 millinator millimeter okay so here we can go with the millinator it will take I think I don't know so let me open the port so here we have rajini 90 okay let's open it okay so there is no email right now so we are opening with the localhost when we go with three thousand enter and let's see the mail is receiving or not public inbox you can see that Republican boss MSS you can see that okay Welcome to the sending email via node.js mailer you can see that right what we have written over here where it is welcome to the notes you can see that now we are able to receive send the emails via the node.js using the nestris any doubt any query in that let me know in the comment section in the coming videos we are going to learn how to send emails via sending the through the email templates and the second one that is attachments also so these two things are coming up in the later videos thank you so much keep supporting me thank you so much have a great day
Info
Channel: Technical Rajni
Views: 16,661
Rating: undefined out of 5
Keywords: Sending email with SendGrid in NestJS, Send Emails with NestJs - GitHub, NestJS Nodemailer Example, Setting Up Email Transfer With NestJS Using NodeMailer, Send Emails with NestJS, nodemailer, nodejs, javascript, nodemailer node js, nestjs, sendgrid, node js, node, nodemailer tutorial, node.js, node js tutorial, nodejs nodemailer, nodemailer gmail, node.js tutorial, nodejs tutorial, send email nodejs smtp, send email nodejs express, send email nodejs gmail
Id: DHcxpZEaVWg
Channel Id: undefined
Length: 7min 3sec (423 seconds)
Published: Wed Mar 15 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.