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'] || 'no-reply@localhost.lan',
    				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'] || 'no-reply@localhost.lan',
    				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...


  • Global Moderator

    This post is deleted!

  • Admin

    @pitaj opened gh#2455

    In the meantime, yes, we can configure this so that a digest is only sent out if you have either

    • An unread notification, or
    • A recent topic
    pitaj created this issue in NodeBB/NodeBB

    closed Move Email digests from core to a plugin #2455


  • Admin



  • You never stop to amaze me on how fast you respond to issues. Thank you! :smile:


Log in to reply
 


Looks like your connection to NodeBB was lost, please wait while we try to reconnect.