From dd6159c0af1aadbeec30e34114cbf5c53220bf71 Mon Sep 17 00:00:00 2001 From: Dan Head Date: Sun, 26 Feb 2017 15:43:18 +0000 Subject: [PATCH] Disable sending emails for now Change email debounce to 1 min --- src/core/emailer.js | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/core/emailer.js b/src/core/emailer.js index 059e970..ad3b411 100644 --- a/src/core/emailer.js +++ b/src/core/emailer.js @@ -19,7 +19,7 @@ Thanks for your RSVP, ${person.attending ? 'we\'re delighted to hear you will be ${person.attending ? `Your meal choices are ${starters[person.starter]} and ${mains[person.main]}.\n` : ''} ${person.attending && person.dietary.length > 0 ? `Your dietary requirements are: ${person.dietary}.\n` : ''} You can modify your RSVP up until ${getRsvpEnd()} here: https://danielandhana.com/${person.password}.\n -${person.attending ? 'See you at our wedding,' : 'See you soon,'}\n +${person.attending ? 'See you at our wedding,' : 'Hope to see you soon,'}\n Daniel and Hana `; } @@ -30,25 +30,27 @@ function getEmailHTML(person) { ${person.attending ? `

Your meal choices are ${starters[person.starter]} and ${mains[person.main]}.

` : ''} ${person.attending && person.dietary.length > 0 ? `

Your dietary requirements are: ${person.dietary}.

` : ''}

You can modify your RSVP up until ${getRsvpEnd()} here.

-

${person.attending ? 'See you at our wedding,' : 'See you soon,'}

+

${person.attending ? 'See you at our wedding,' : 'Hope to see you soon,'}

Daniel and Hana

`; } export const sendRSVPEmail = function sendRSVPEmail(person) { - const mailOptions = { - from: `"${email.senderName}" <${email.senderAddress}>`, - to: person.email, - subject: 'Thank you for your RSVP', - text: getEmailText(person), - html: getEmailHTML(person), - }; - // send mail with defined transport object - transporter.sendMail(mailOptions, (error) => { - if (error) { - handleError(error); - } - }); + if (email.enabled) { + const mailOptions = { + from: `"${email.senderName}" <${email.senderAddress}>`, + to: person.email, + subject: 'Thank you for your RSVP', + text: getEmailText(person), + html: getEmailHTML(person), + }; + // send mail with defined transport object + transporter.sendMail(mailOptions, (error) => { + if (error) { + handleError(error); + } + }); + } }; export const sendRSVPEmailWithDebounce = function sendRSVPEmailWithDebounce(person) { @@ -57,6 +59,6 @@ export const sendRSVPEmailWithDebounce = function sendRSVPEmailWithDebounce(pers clearTimeout(emailTimers[person.key]); emailTimers[person.key] = setTimeout(() => { sendRSVPEmail(person); - }, 10000); + }, 60000); } };