multiple categories
skizzo - September 17, 2007 - 15:02
| Project: | Mass Contact |
| Version: | 5.x-2.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | oadaeh |
| Status: | active |
Description
If a user belongs to three all "categories" (eg: roles A and B and C)
and a mail is sent to multiple categories, will he/she receive
multiple copies of the same message? If that is the case, could
such occurence be avoided? Thanks.

#1
It should do that already, but I'll double check to make sure.
#2
Okay, this doesn't actually work. I will try to come up with a fix in the next few days.
#3
After reviewing the code and thinking about this issue at length, I don't believe this is a bug. It may be a feature request, but with the way the code currently works, one that would be difficult to impossible to implement. (Well, probably not impossible, but maybe so difficult as to make me not want to attempt it.)
The module processes each category separately, discarding the information about the previous category when a new one is started. I would need to save each user in a separate data location of some sort (variable, database, ???) as the category was being processed. Then I would need to check that data location for each successive user of each successive category. Also, I would be arbitrarily deciding which category gets sent to the user.
I would also probably want to give administrators the option of whether to allow this behavior or not, as some people might want to receive the multiple e-mails.
#4
I'd like to see this "feature" implemented too.
I raised an bug report http://drupal.org/node/289875 as didn't notice this item when looking through bug list.
(Note, we've switched off putting the category title in the subject line as that is not a feature we use at all. Hence for us there is no need to process each category one at a time)
#5
This is my version of the mass contact module. It has three main differences.
1) the while loop that begins at line 1145 ends earlier. The main purpose of the loop in the original module was for looping through all categories and sending out a mass email with a different subject for each category. I didn't need this since they want my clients don't care about small changes in the subject line.
Now the while loop's purpose is to build a list recipients. I kept the opt-out and role-driven list modification features.
2) After the list of recipients is built, I dedup the list with the array_unique function.
3) The subject is restricted to the value that's passed from the form. No category specific text was kept. This subject setting occurs later in the foreach recipient loop. (probably should refactor).
It works for me. Let me know how I can cleanup this change for general consumption.