const makeSendEmail = (subjectTemplate, bodyTemplate) => async (to, ...props) => {
const mailsRef = firestore.collection("mails");
const subject = subjectTemplate(...props);
const html = bodyTemplate(...props);
const mail = {…};
…
};
//use
const sendUpdatePasswordEmail = makeSendEmail(
(language) => t("subject.scope", language),
updatePasswordTemplate
);
//call
sendUpdatePasswordEmail(emailAddress, language);