Page 1 of 1
receiving email notifications via a daily digest
Posted: 09 Oct 2018, 17:13
by nerdtron
We've installed MantisBT on our web server and have Email notifications enabled.
Currently, a separate Email is sent for each applicable event.
Is there any way for a user to request that the notifications be sent to them as a single daily digest email? Rather than receiving a separate Email for each notification?
Version Info:
MantisBT v2.17.1
PHP 5.6.36
MySQL 5.6.39
Apache 2.6.32
Re: receiving email notifications via a daily digest
Posted: 09 Oct 2018, 17:25
by atrol
Re: receiving email notifications via a daily digest
Posted: 13 Oct 2018, 14:53
by nerdtron
Thanks for the reply! Looks like it may be worth spending some time to develop a plug-in. For now I've asked those who requested it to setup an inbox filter so all the notifications go into a folder. Having a digest would be a nice per-user option though.
Re: receiving email notifications via a daily digest
Posted: 15 Oct 2018, 23:19
by nerdtron
I did some reading in the developer docs on plug-ins. Here's how I'm thinking it could work.
- intercept sending Email notifications
- check global preference and/or user specific setting for a digest preference and only continue if applicable
- rather than sending the EMail, log the notification in a table
- have a periodic script, runnable via cron that works through the table used above and for each user groups and formats all their notifications into a single digest Email
- setup a cron job to run the script daily
Not entirely sure this is achievable with the current plug-in architecture and set of events in MantisBT though.
Re: receiving email notifications via a daily digest
Posted: 16 Oct 2018, 12:56
by atrol
I can't invest a lot of time in this, thus just a few hints that might help.
nerdtron wrote: ↑15 Oct 2018, 23:19
rather than sending the EMail, log the notification in a table
No need to implement it yourself, this is exactly how Mantis notifications work, use this function from core/email_api.php for it
Code: Select all
/**
* Store email in queue for sending
*
* @param string $p_recipient Email recipient address.
* @param string $p_subject Subject of email message.
* @param string $p_message Body text of email message.
* @param array $p_headers Array of additional headers to send with the email.
* @param boolean $p_force True to force sending of emails in shutdown function,
* even when using cronjob
* @return integer|null
*/
function email_store( $p_recipient, $p_subject, $p_message, array $p_headers = null, $p_force = false )
nerdtron wrote: ↑15 Oct 2018, 23:19
have a periodic script, runnable via cron that works through the table used above and for each user groups and formats all their notifications into a single digest Email
setup a cron job to run the script daily
Have a look at scripts/send_emails.php and check option $g_email_send_using_cronjob in Admin Guide
http://mantisbt.org/docs/master/en-US/A ... nfig.email
Re: receiving email notifications via a daily digest
Posted: 16 Oct 2018, 15:45
by nerdtron
Thanks for the reply and the hints. I'll try and dig into that if I can find some time to do so.