Mahara has a VERP system to disable email addresses that have been bouncing. "Bounces_min" and "Bounces_ratio", and it disables an email when it has received more than "bounces_min" bounces and the ratio of bounced messages to all messages sent is greater than bounces_ratio.
The thing is, these are *lifetime* numbers, and never get reset. This poses some difficulties once a site has been around for a few years, like mahara.org. We have some email addresses that have received thousands of messages. So, if we set bounces_threshold to something like the default "0.2" setting, then if one of those longtime addresses become invalid, we would continue to send hundreds of messages to it before we got around to disabling it. On the other hand, if we set bounces_threshold to 0, then we have the problem that the bounce count is cumulative and never gets reset. So, if we leave it at the default 5 emails, I could get disabled due to one bounce every three months over the course of a year and a half.
Really, whether to disable someone's email should be based on how much it has been bouncing *recently*. So what we should do is add a cron task which sets the artefact_internal_profile_email.maillsent and artefact_internal_profile_email.bouncecount columns back to 0 periodically.
Ideally, the frequency would be something that could be set by a config variable, and each bounce would individually age out when it hit the age limit. But, to do that we'd need to create a new table to track the bounces and a lot of logic, so it's probably not worth it. I think instead, arbitrarily just zeroing everything every N days gets us fairly close to the same thing:
1. We add a config variable called, say, $cfg->bounces_ resetdays, which takes an integer representing how many days we should go between resetting the bouncecounts.
2. We add a cron task that runs once daily. It uses a value in interaction_config to determine the last time it zeroed the bouncecounts, and by comparing that and $cfg->bounces_ resetdays, it's determines whether to zero stuff out on this cron run or not.
3. If $cfg->bounces_ resetdays = 0, or false, the cron task exits early and never resets them.