Last active
August 28, 2017 19:58
-
-
Save elnygren/184677f06c9f9fc96047d19ac93dceeb to your computer and use it in GitHub Desktop.
Tactforms email.js part of https://gist.github.com/elnygren/d0b22d085a3bef7dca139af94bc5a870 Raw
This file contains hidden or 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 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