Рет қаралды 1,303
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