Forums | Mahara Community

Support /
Disabling e-mail (per-user)

anonymous profile picture
Account deleted
Posts: 214

22 October 2009, 10:06

Disabling e-mail to a user

As part of our Mahara development, we're looking to make it possible to
disable users' e-mail and I'm looking at the best way to go about this.

The main reason we want to do this is to handle bounces with VERP (probably
borrowing the moodle VERP ideas), but also to allow users to disable e-mail
themselves should they so desire.

Before we implemented the Moodle VERP control, we were sending out in the
region of 20,000 bouncing e-mails per day.

Looking into how this could best be done, I notice that e-mail addresses
are currently stored in two locations within the database - the usr table
and the artefact_internal_profile_email table. I would guess that the best
place to keep track of a bounce count (for VERP) would be in the
artefact_internal_profile_email table. This could be checked within the
email_user function at send time relatively easily.

Similarly, would this be the best place to keep track of the disabled
status, or would it be best to keep this state information in the usr
table to keep it user centric rather than address centric?

I also notice that in the roadmap for School Usage
(, one suggestion is to remove
the unique constraint upon e-mail addresses - monitoring whether an e-mail
address is enabled or disabled then becomes even more tricky.

Any thoughts or comments would be gratefully appreciated,


anonymous profile picture
Account deleted
Posts: 1643

22 October 2009, 18:06

Hi - yes, artefact_internal_profile_email is the best place for bounce counts. That table exists because users can have up to five e-mail addresses.

The disabled status is a bit different. I'm guessing that you mean that if an email is disabled, Mahara should not send a message to it. But it probably makes more sense that users can say "send me e-mail or never send me email", and not think about which addresses are disabled or not, because only one address is ever being sent e-mail anyway - the one that's in the usr table. That's probably something that should be a user account preference, which means it should go in the usr_account_preference table (where it's actually _set_ is another story, it might make sense on the settings page and might make sense on the profile page where the emails are).

Do bounces get returned at email_user() time? I wouldn't think so? I thought that bounces are e-mails sent from the other server, and you have to have a script registered to handle them? 

I'm not sure about that roadmap item. It might mean that they don't want students to have to have an e-mail address at all, rather than allowing them to have one that's the same as another user's. As it is, I'm not entirely sure that Mahara's email addresses are checked to be unique at the database level anyway - for example, I think you might be able to sneak an SSO user into the system with the same address as another user. 

2 results