This would allow a development site to be used by multiple developers, testers or client representatives while still blocking the majority of emails.

CommentFileSizeAuthor
#4 reroute_email.module.txt2.45 KBmikeryan

Comments

kbahey’s picture

Again, if this is an option, I can include it if you write a patch for it.

Note that usernames is not realistic here, since hook_mail_alter() does not get passed a user ID. Unless you mean the user ID of a logged in user.

So, perhaps a text box with a list of email addresses that are allowed to go through would be the way to go.

jonathan_hunt’s picture

Ok, I'll get to work on a patch. The reason I suggested usernames is that in many cases an administrator will know the username but may not know the email address (without looking it up). Based on a set of usernames this module could build a set of associated email addresses from the user objects and compare the outgoing To: address...

kbahey’s picture

In that case, then allow both: usernames (and the settings looks up their email), and/or raw email addresses.

mikeryan’s picture

Version: 5.x-1.0 » 6.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new2.45 KB

I needed the ability to specify multiple pass-through email addresses on Drupal 6, so here's a patch to accomplish this. I didn't have a need to deal with usernames, so that part of the initial request is not implemented.

kbahey’s picture

I committed this, with a few modifications.

I was taken aback for a while by the "first email is special", but then it is documented and simple enough, so why not ...

I don't like the double ternaries at the very end. Can we make them simpler?

kbahey’s picture

Status: Needs review » Fixed

marking as fixed.

@jonathan_hunt, if you want that in 5.x then please create a backport from 6.x so the code is the same across version, not different features that will not carry forward in new versions.

mikeryan’s picture

re: "first email is special" - a little laziness there, a separate field for the default email address may be cleaner, but I think this implementation is actually a little better for the environment where I'm using this.

Agreed on the ternaries (but then I didn't write them:-). The isset() doesn't appear necessary, the is_array() seems adequate...

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.