Something went wrong. Try again.
VueTube is a YouTube clone built with nodejs, expressjs & mongodb. This is the RESTful API repository.
Something went wrong. Try again.
788 B · 27 lines
JavaScript
at master
12345678910111213141516171819202122232425262728const nodemailer = require('nodemailer')
const sendEmail = async options => { // create reusable transporter object using the default SMTP transport const transporter = nodemailer.createTransport({ host: process.env.SMTP_HOST, port: process.env.SMTP_PORT, auth: { user: process.env.SMTP_EMAIL, pass: process.env.SMTP_PASSWORD } })
// send mail with defined transport object const message = { from: `${process.env.FROM_NAME} <${process.env.FROM_EMAIL}>`, // sender address to: options.email, // list of receivers subject: options.subject, // Subject line text: options.message // plain text body }
const info = await transporter.sendMail(message)
console.log('Message sent: %s', info.messageId)}
module.exports = sendEmail