Last active
September 27, 2023 05:08
-
-
Save dineshdeveloper1/42b1c0438bf1e37ab62aded64d85a5dc to your computer and use it in GitHub Desktop.
Node Nodemailer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var nodemailer = require('nodemailer'); | |
// var transporter = nodemailer.createTransport({ | |
// service: 'gmail', | |
// auth: { | |
// user: 'youremail@gmail.com', | |
// pass: 'yourpassword' | |
// } | |
// }); | |
const transporter = nodemailer.createTransport({ | |
host: 'smtp.ethereal.email', | |
port: 587, | |
auth: { | |
user: 'maggie41@ethereal.email', | |
pass: 'Ap4wfJypvDK65HHxkb' | |
} | |
}); | |
var mailOptions = { | |
from: 'youremail@gmail.com', | |
to: 'myfriend@yahoo.com', | |
// to: 'myfriend@yahoo.com, myotherfriend@yahoo.com', | |
subject: 'Sending Email using Node.js', | |
text: 'That was easy!' | |
// html: '<h1>Welcome</h1><p>That was easy!</p>' | |
}; | |
transporter.sendMail(mailOptions, function(error, info){ | |
if (error) { | |
console.log(error); | |
} else { | |
console.log('Email sent: ' + info.response); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment