- Mailer setup

This commit is contained in:
2019-08-20 08:39:10 -04:00
parent dce868f2ac
commit 697b04a55b
9 changed files with 203 additions and 44 deletions

28
emails/user.js Normal file
View File

@@ -0,0 +1,28 @@
const config = require('../config');
const helpers = require('../lib/helpers');
const Mailer = require('../lib/Mailer');
module.exports = {
confirmation: ({ email, firstName, token }, callback = helpers.emptyFunction) => {
const link = `${config.api.url}${config.security.confirm.route}/${encodeURI(token)}`;
const mail = {
subject: 'Please confirm your account',
text: `Please confirm your account\r\r\r\r${firstName},\r\rAn account was recently created on the Eventment giving platform for this email (${email}).\r\rTo complete your registration, please open this link in your browser: ${link}\r\rIf you did not create this account, please disregard this email.`,
html: `<h2>Please confirm your account</h2><p>${firstName},</p><p>An account was recently created on the Eventment giving platform for this email (${email}).</p>To complete your registration, please <a href="${link}">click here</a>.</p><p><b>If you did not create this account, please disregard this email.</b></p>`,
};
Mailer(email, mail, callback);
},
reset: ({ email, firstName, token }, callback = helpers.emptyFunction) => {
const link = `${config.api.url}${config.security.reset.route}/${encodeURI(token)}`;
const mail = {
subject: 'Please confirm your account',
text: `Password Reset Request\r\r\r\r${firstName},\r\rA password reset request was made for your account on the Eventment giving platform.\r\rTo reset your password, please open this link in your browser: ${link}\r\rIf you did not make this request, you may disregard this email and your password will remain unchanged.`,
html: `<h2>Password Reset Request</h2><p>${firstName},</p><p>A password reset request was made for your account on the Eventment giving platform.</p>To reset your password, please <a href="${link}">click here</a>.</p><p><b>If you did not make this request, you may disregard this email and your password will remain unchanged.</b></p>`,
};
Mailer(email, mail, callback);
},
};