Skip to content

Instantly share code, notes, and snippets.

@chuck0523
Last active April 25, 2017 18:33
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 chuck0523/be104f76b8a98f462f30be21c99745f1 to your computer and use it in GitHub Desktop.
Save chuck0523/be104f76b8a98f462f30be21c99745f1 to your computer and use it in GitHub Desktop.
const smtpConfig = {
host: 'smtp.gmail.com',
secure: true, // use SSL
auth: {
user: process.env.GMAIL_ADDRESS,
pass: process.env.GMAIL_PASSWORD,
},
}
const transport = require('nodemailer').createTransport(smtpConfig)
module.exports.sendMail = ({ subject, text }) => {
return transport.sendMail({
from: process.env.GMAIL_ADDRESS,
to: process.env.GMAIL_ADDRESS,
subject,
text,
})
.catch(err => console.error('Fail to send mail: ', err))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment