Exposing My Ignorance /
Mahara has a VERP system!

I've been working on Mahara for about a year now, and I'm still frequently surprised by the discover of new features in it. One recent one, was that Mahara has a fully functional VERP system for handling bounced emails.

About a month ago I was discussing on the forums the possibility of adding reply-by-email functionality to the Mahara forums and Mahara inter-person messages. It's a fairly frequently requested feature, but, I said, the problem is that you'd need to implement a lot of infrastructure to handle it, specifically, you've gotta do VERP, a system by which you provide a different Reply-To address to each message, with identifying information encoded in the address. Then when a person replies by email, you can figure out what they were replying to and authenticate them to some extent, just by looking at the address they sent to. You also need to set up infrastructure for receiving these response emails either by checking an IMAP account or by setting up your incoming SMTP server to pipe messages to your own command-line script.

That'd be great to have, but it's a lot of work so it was unlikely to materialize any time soon.

That's what I thought, anyway. Then, while looking through the list of cron tasks in Mahara's "cron" table, I noticed one that called the function "check_imap_for_bounces()". On investigation it became apparent that Mahara already has a fully functional VERP system, fully documented in the config-defaults.php file, and accessible by SMTP script or IMAP! Not only that, but the IMAP version has been there since Mahara 1.6, and the SMTP version since 1.3!

Admittedly, the documentation for this is still a little sparse. As mentioned, all the necessary configuration elements are described in the config-defaults.php file, which is a good start. If you're not familiar with config-defaults.php, you should check it out. It's actually htdocs/lib/config-defaults.php. This is a file which defines default values for many Mahara configuration parameters, as well as describing many others that are left undefined by default.

Other than that, the only documentation for it is a page on the Mahara wiki, which still inaccurately describes it as a feature "under development", even though it's been complete and working for years now: https://wiki.mahara.org/index.php/Developer_Area/Specifications_in_Development/VERP_Mail_Bounces

I immediately wondered why we weren't already using this on mahara.org, a site that receives hundreds or thousands of bounce emails each day. And apparently it had been set up at some point in the past, but had apparently been forgotten about and disabled since then, probably during a big migration in the site's server and deployment system around December 2012. I re-enabled it (using IMAP polling, because that seems more likely to continue operating even if we forget about it or move servers again), and it's been working like a charm.

I don't believe this is an uncommon experience, when working on a project as long-lived and large as Mahara (and Mahara's scope is actually relatively small when compared to other projects, like Moodle). Mahara has hundreds of thousands of lines of PHP code, and hundreds of features, more than anyone can easily encompass. What can you do about that? One thing is to code defensively and avoid breaking internal API's. Automated testing would be nice, and we're working on that. And listening to the community -- often that's one of the main ways I discover new features... and find out that they've been broken.