is it possible to configure daily email to send only if there is at least one event?
-
When user configure their notification level to daily digest they will receive an email every day regardless of there being any new messages on the forum. So when there is no message they get an email saying:
There have been no active topics in the past day
I have received feedback from users that they would prefer not to receive a message if there has been no new activity. I am using nodebb mandrill email plugin. I am not sure if this specific to plugin or is in the core. Can someone point me in the right direction how to make this change?
-
@arasbm said:
There have been no active topics in the past day
I don't have an exact answer, but I can steer you in the right direction...
src/emailer.js
has this code in it:Plugins.fireHook('action:email.send', { to: results.email, from: meta.config['email:from'] || '[email protected]', subject: translated[2], html: translated[0], plaintext: translated[1], template: template, uid: uid });
A hacky way might be to wrap that method in an if statement like this:
if (translated[1] !== "There have been no active topics in the past day") { Plugins.fireHook('action:email.send', { to: results.email, from: meta.config['email:from'] || '[email protected]', subject: translated[2], html: translated[0], plaintext: translated[1], template: template, uid: uid }); }
THIS IS NOT AN EXACT ANSWER. I'm just throwing this out there to steer towards a solution. I have no idea what translated[1] would give you...
Using
grep
helps with this type of stuff...for example from your nodebb root you can do:grep -r "There have been no active topics in the past day"
It will search recursively through and spit out the file name and line of text wherever it finds the matched string...I use this a lot for tracing functionality through nodebb core. Really helpful if you are writing plugins and want to trace the hooks to their source...
-
This post is deleted!