Last active
April 25, 2017 18:33
-
-
Save chuck0523/be104f76b8a98f462f30be21c99745f1 to your computer and use it in GitHub Desktop.
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
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