Multiple email addresses associated with single user account?

Multiple email addresses associated with single user account?

by karen obrien -
Number of replies: 15

Hi,

I'm a Moodle newbie (administrator).

Is it possible to have a single Moodle user account set up with two associated email addresses?

I ask this as our user accounts are created automatically from LDAP.. meaning user email accounts are set automatically (to college email accounts).

Because user accounts are set up from LDAP, students cannot manually update their email address (using 'edit profile'), e.g. to an email address they use more regularly (they might not use their college email account, and may prefer to use a google/yahoo/hotmail/etc account).

I was thinking it would be handy if you could specify an 'alternate' email address in Moodle under your profile, so that all emails from Moodle would be sent both to your default email address (college email account), plus your 'alternate' email address (google/yahoo/hotmail/etc).

Just wondering if this was possible in Moodle, and if so, what settings would need to be updated?

(p.s. I've done forum searches for 'alternate email' and 'multiple email' to see if this topic has been previously discussed but no joy)

Average of ratings: -
In reply to karen obrien

Re: Multiple email addresses associated with single user account?

by Rosario Carcò -
Hi, I just ran into the same question this week because Students and Teachers type in invalid eMail-Addresses and then I receive according Error-Mails in the admin mailbox.

Students often simply mistype their addresses in the profile, so an immediate check of the validity would be a good thing to implement.

Sometimes students simply change address without editing/updating their moodle profile.

But there is the Teacher's problem who wants to have his teacher account and his student test account to have the same eMail address.

I was more lucky than you searching for:

forumid:32 "same email address"

The list of possible workarounds and suggestions is quite long (and I haven't finished reading all actually). But I wonder why nobody of the programmers explains WHY uniqueness is checked on the eMail Field and WHY the Moodle Admin is not able to choose uniqueness or not as an option for user creation. This would solve many of the cases I read until now, and even our one.

So here is a partial list of suggestions and workarounds I found. What I did is edit the user table with phpMyAdmin to assign the same eMail address to Teacher and its testaccount, hoping that Moodle will not reject this as inconsistency one day:

http://moodle.org/mod/forum/discuss.php?d=101232#p447747

http://moodle.org/mod/forum/discuss.php?d=93648#p413471

http://moodle.org/mod/forum/discuss.php?d=91720#p405117

http://moodle.org/mod/forum/discuss.php?d=52770#p240928

http://moodle.org/mod/forum/discuss.php?d=7706#p132533

http://moodle.org/mod/forum/discuss.php?d=22591#p106920

http://moodle.org/mod/forum/discuss.php?d=4178#p18721

In the latter post of 2003 Martin Dougiamas writes: Currently these are necessary, but there will eventually be admin options to change this.

So I have to check again in my Version 1.9.3+ whether uniqueness can be disabled by the admin.

I will report back, Rosario


In reply to Rosario Carcò

Re: Validity check for password change

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi Rosario,

Regarding a validity check when a user changes their password, you'll be pleased to hear that this has been implemented in Moodle 1.8.6 and 1.9.2 onwards. It's enabled by default in Administration > Security > Site policies.
In reply to karen obrien

Re: Multiple email addresses associated with single user account?

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi Karen,

Rather than trying to have multiple email addresses for each account, how about allowing users to change the email address set when their account was created? Please see Administration > Users > Authentication > LDAP Server.
In reply to karen obrien

Re: Multiple email addresses associated with single user account?

by Suud Ridzuan -
Dear Karen,

How are you catch up with multiple emails for single account?

I'm posed with the same issue. I made an entry recently in Moodle Tracker: http://tracker.moodle.org/browse/MDL-19128. What do you think?


I'm maintaining University of Malaya, Kuala Lumpur, Malaysia E-Learning that is now converting to Moodle.

Just like in many other universities I've talked to before, students are more likely to favor popular web email e.g. yahoo, gmail etc rather than the university's email. In many occasion students do not check this email often. And many lecturers dislike using the university's. Obviously because of the features gmail and yahoo have.

I would suggest that an alternative email field should be established in the user profile and radioboxes to select which email as main and alternate.

Looking at the core of Moodle, only one email address must be set active. Therefore the radiobox would function to put the main email on the current email field and leave the other email on alternate.

Please comment on this issue, I would like to share this as much as possible with other Moodlers.
In reply to Suud Ridzuan

Re: Multiple email addresses associated with single user account?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
You can define custom fields to add to the user profile. So you can add an 'alternate email address' field. But Moodle will only use the main email address. The only way to change which email address is your main one would be to edit your profile, and use copy and paste to swap the main and alternate email addresses.
In reply to Tim Hunt

Re: Multiple email addresses associated with single user account?

by Suud Ridzuan -
Appreciate the reply Tim.

At this moment, I've decided to put campus email as their login thus eliminating this email problem.

Being students and also teaching staffs, they prefer straight forward approach. Having an extra field "alternate email address" would have minimal impact. Might as well just keep the email field unlocked.

The real problem pops up as Moodle is being used to host other applications, LAMS, Turnitin etc. By taking their username as email, with no or minimal code adjustment, would just work.

I hope to hear real life cases of this kind of issues.
In reply to Tim Hunt

Re: Multiple email addresses associated with single user account?

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers
Tim,

Sorry if I seem to be jumping in at the wrong place with my comment.

I would like to see Moodle support multiple email addresses. Right now, I do send class emails to my students from my email client. I allow students to give me all their preferred email addresses. It could be their school, business, cell phone (around 5% of my students want emails to go to their cell phones already), or other email accounts. My concern is to make sure that, as a teacher, my messages get to the students.

I would prefer to do this in Moodle instead of from my email client.

Additionally, maybe some students would want to use other technologies (that I really don't know about specifically), such as Skype, Twitter, Facebook?, or others.

I would like the developers to think more broadly about email and overall communications.
In reply to Rick Jerz

Re: Multiple email addresses associated with single user account?

by Bernadette Langdon -
Another excellent reason to have multiple emails associated with one user relates to younger student moodlers.  It would be helpful to accommodate divorced parents who both want access to their child's moodle account.  Both parents want to get update notes on news, forums etc. Two emails for one student would keep them both in the loop.  Anyone figure out how to do that yet?
Average of ratings: Useful (3)
In reply to Bernadette Langdon

Re: Multiple email addresses associated with single user account?

by Paul Hodgson -
Completely agree and I am looking to hack this at the moment - any pointers to the correct files to hack?

It much be possible to add a database call to add a secondary email field in the "To:" field of the email?
In reply to Bernadette Langdon

Re: Multiple email addresses associated with single user account?

by Juan sebastian Murillo Sarmiento -

My friend Bernadette, yess... for me this is usefull, i need this, 

You know how to do that?  

regards

In reply to karen obrien

Re: Multiple email addresses associated with single user account?

by Paul P. -

This has been reported in MDL-20318 already. Please vote for it there so it gets a priority upgrade.

In reply to Paul P.

Re: Multiple email addresses associated with single user account?

by Linda Bellomo -

I tried to vote, but it doesn't seem to let me. I see there has been more conversation about this, but I don't understand all of the "code talk" very well. Has anyone gotten a solution for a production installation yet?

In reply to karen obrien

Re: Multiple email addresses associated with single user account?

by Paul P. -

One way to fix this (as I discovered while playing around on a test installation) is that if the regular expression for the validate_email() function in lib/weblib.php is modified to allow a comma separated list of emails then forum posts, profile updates and account registrations will all be sent to every email address in the list.

Now the way I did it was by commenting out the entire regex and returning true. This is obviously not appropriate for a production site, but I am no regex expert (and just looking at the regex in the file made my eyes hurt).

Here is the function:


function validate_email($address) {

return (ereg('^[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+'.
'(\.[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+)*'.
'@'.
'[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.
'[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$',
$address));
}

Here is what I did (not good, but gets all the emails sent out):


function validate_email($address) {

/* return (ereg('^[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+'.
'(\.[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+)*'.
'@'.
'[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.
'[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$',
$address));*/

return true;
}

Now, if a user types in user1@mail.com,user2@aol.com,user3@msn.com all accounts will receive the mail.

If anyone can come up with a modification of the regex to accept a comma separated list, I think this will solve this issue.

In reply to karen obrien

Re: Multiple email addresses associated with single user account?

by Paul P. -

This regular expression seemed to work:


function validate_email($address) {

return (ereg('^[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+'.
'(\.[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+)*'.
'@'.
'[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.
'[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.
'([,;]\s*'.
'^[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+'.
'(\.[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+)*'.
'@'.
'[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.
'[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.
')*',
$address));


}

In reply to Paul P.

Re: Multiple email addresses associated with single user account?

by Raja ba -

Hi, 

I have already created on my profile edit an generated mail and an alternate mail for my user in the platform, so now i want that when i send an email to an user that he can receive this email on this two which he is linked.

smile