feat: add filter:email.cancel to allow plugins to cancel sending emails

v1.18.x
Barış Soner Uşaklı 4 years ago
parent 1590cdf19f
commit c2e2370655

@ -230,6 +230,16 @@ Emailer.send = async (template, uid, params) => {
params.uid = uid;
params.username = userData.username;
params.rtl = await translator.translate('[[language:dir]]', userSettings.userLang) === 'rtl';
const result = await Plugins.hooks.fire('filter:email.cancel', {
cancel: false, // set to true in plugin to cancel sending email
template: template,
params: params,
});
if (result.cancel) {
return;
}
await Emailer.sendToEmail(template, userData.email, userSettings.userLang, params);
};

Loading…
Cancel
Save