How to SEND MAIL using Nodemailer in Node js || Send Mail from Node js || Nodemailer || Node js

Опубликовано: 29 Сентябрь 2024
на канале: Coding Comics
1,301
23

Discover how to send emails using Nodemailer in Node.js. This guide walks you through setting up Nodemailer, configuring SMTP settings, and creating a simple function to send emails from your Node.js application, allowing for seamless email communication.

code:

const nodeMailer = require('nodemailer')

let transportmail = nodeMailer.createTransport({
service:'gmail',
auth:{
user:'your email',
pass:'your app password'
}
})

let mailContent = {
from:"your email",
to:'to email',
subject:'Test Mail',
text:"This is from coding comics"
}

transportmail.sendMail(mailContent,function(err,val){
if(err){
console.log(err)
}else{
console.log(val.response,"sent Mail...")
}
})


#node.js #nodemailer #sendmail