Skip to content

Instantly share code, notes, and snippets.

@elnygren
Last active August 28, 2017 19:58
Show Gist options
  • Save elnygren/184677f06c9f9fc96047d19ac93dceeb to your computer and use it in GitHub Desktop.
Save elnygren/184677f06c9f9fc96047d19ac93dceeb to your computer and use it in GitHub Desktop.
const config = require('./config')
const mailgun = require('mailgun-js')({apiKey: config.MAILGUN_API_KEY, domain: config.MAILGUN_DOMAIN})
// poor man's email templating
const VERIFICATION_EMAIL = (forwarder, secret) => `Hi,
To verify your Tactforms.com form, click this link:
https://tactforms.com/api/secret/${forwarder}/${secret}
Your form's secret url is:
https://tactforms.com/f/${forwarder}
If you did not create a form at tactforms.com then you may ignore this message.
- Tactforms
`
// even when cowboy coding I prefer to create these wrappers
// it helps keep `server.js` in check and eases mental load
async function sendVerificationEmail(email, forwarder, secret) {
await sendEmail(email, 'Tactforms Verification', VERIFICATION_EMAIL(forwarder, secret))
}
module.exports = {
sendVerificationEmail,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment