Skip to content

Instantly share code, notes, and snippets.

@phenomnomnominal
Created June 21, 2019 11:59
Show Gist options
  • 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 πŸ’‰" <[email protected]>',
to: '[email protected]',
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