Disable sending emails for now
Change email debounce to 1 min
This commit is contained in:
@@ -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 ? `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` : ''}
|
${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
|
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
|
Daniel and Hana
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
@@ -30,25 +30,27 @@ function getEmailHTML(person) {
|
|||||||
${person.attending ? `<p>Your meal choices are <b>${starters[person.starter]}</b> and <b>${mains[person.main]}</b>.</p>` : ''}
|
${person.attending ? `<p>Your meal choices are <b>${starters[person.starter]}</b> and <b>${mains[person.main]}</b>.</p>` : ''}
|
||||||
${person.attending && person.dietary.length > 0 ? `<p>Your dietary requirements are: <b>${person.dietary}</b>.</p>` : ''}
|
${person.attending && person.dietary.length > 0 ? `<p>Your dietary requirements are: <b>${person.dietary}</b>.</p>` : ''}
|
||||||
<p>You can modify your RSVP up until <b>${getRsvpEnd()}</b> <a href="https://danielandhana.com/${person.password}">here</a>.</p>
|
<p>You can modify your RSVP up until <b>${getRsvpEnd()}</b> <a href="https://danielandhana.com/${person.password}">here</a>.</p>
|
||||||
<p>${person.attending ? 'See you at our wedding,' : 'See you soon,'}</p>
|
<p>${person.attending ? 'See you at our wedding,' : 'Hope to see you soon,'}</p>
|
||||||
<p>Daniel and Hana</p>
|
<p>Daniel and Hana</p>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const sendRSVPEmail = function sendRSVPEmail(person) {
|
export const sendRSVPEmail = function sendRSVPEmail(person) {
|
||||||
const mailOptions = {
|
if (email.enabled) {
|
||||||
from: `"${email.senderName}" <${email.senderAddress}>`,
|
const mailOptions = {
|
||||||
to: person.email,
|
from: `"${email.senderName}" <${email.senderAddress}>`,
|
||||||
subject: 'Thank you for your RSVP',
|
to: person.email,
|
||||||
text: getEmailText(person),
|
subject: 'Thank you for your RSVP',
|
||||||
html: getEmailHTML(person),
|
text: getEmailText(person),
|
||||||
};
|
html: getEmailHTML(person),
|
||||||
// send mail with defined transport object
|
};
|
||||||
transporter.sendMail(mailOptions, (error) => {
|
// send mail with defined transport object
|
||||||
if (error) {
|
transporter.sendMail(mailOptions, (error) => {
|
||||||
handleError(error);
|
if (error) {
|
||||||
}
|
handleError(error);
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const sendRSVPEmailWithDebounce = function sendRSVPEmailWithDebounce(person) {
|
export const sendRSVPEmailWithDebounce = function sendRSVPEmailWithDebounce(person) {
|
||||||
@@ -57,6 +59,6 @@ export const sendRSVPEmailWithDebounce = function sendRSVPEmailWithDebounce(pers
|
|||||||
clearTimeout(emailTimers[person.key]);
|
clearTimeout(emailTimers[person.key]);
|
||||||
emailTimers[person.key] = setTimeout(() => {
|
emailTimers[person.key] = setTimeout(() => {
|
||||||
sendRSVPEmail(person);
|
sendRSVPEmail(person);
|
||||||
}, 10000);
|
}, 60000);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user