Skip to content

Instantly share code, notes, and snippets.

@phenomnomnominal
Created June 21, 2019 11:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phenomnomnominal/29447a79f0c2fd73130542370e2a202b to your computer and use it in GitHub Desktop.
Save phenomnomnominal/29447a79f0c2fd73130542370e2a202b to your computer and use it in GitHub Desktop.
const nodemailer = require('nodemailer');
const transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: process.env.SENDER_EMAIL,
pass: process.env.SENDER_PASSWORD
}
});
async function sendEmail (info) {
try {
await transporter.sendMail({
from: '"BIOMETRICS APPOINTMENT FINDER ๐Ÿ’‰" <biometrics@not.real>',
to: 'craigspence0+biometrics-appointment@gmail.com',
subject: info,
text: info,
html: `<b>${info}</b>`
});
console.log('๐Ÿ‡ธ๐Ÿ‡ช๐Ÿ’‰ Info: Sent email');
} catch (error) {
console.error('๐Ÿ‡ธ๐Ÿ‡ช๐Ÿ’‰ Error:', error);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment