I've been looking for a module to send e-mail to groups of users. I looked at Advanced User: http://drupal.org/node/121840 which filters e-mails by profile and Mail (previously mass_contact): http://drupal.org/node/114293 which sends e-mail to users by role.
I was thinking of trying to modify one of these for my purposes when it hit me: The views module easily organizes the variety of e-mail groups I'd like to send to. Then I started looking at the views modules, and located View Field: http://drupal.org/project/viewfield which allows you you save a views query in a node field.
Close. But, what I really want is to create a view with exposed filters so that a user with group e-mail permissions can create his own customized view. I then would like to export the resulting sql from this customized view to a node or file or something so that it could be used by a mass mailer to send out e-mail to that group.
I'm writing to ask for some suggestions on getting the resulting sql from the displayed view so that it could be stored. Again, I'm not looking for the sql of the saved view (which ViewFields gets now), but rather, the sql of the view that a user has created once he has customized the original view with the exposed filters. Why not have the user simply create the exact view in views? Because it's a much steeper learning curve than selecting the options he wants from the exposed filters. Less to worry about in terms of users updating or deleting other views.
Thanks for any suggestions, or if you can point me to a module which gets me close to what I want to do.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | README_12.txt | 6.18 KB | somebodysysop |
| #9 | README_10.txt | 5.32 KB | somebodysysop |
| #7 | views_mail.module.txt | 31.84 KB | karens |
Comments
Comment #1
karens commentedI started something like this some time ago and haven't been able to work on it since. The idea designed was to identify a view as an 'email view' that had some settings where you could identify where the email should go for each item in the view (either to the uid of the node author or to an email field from the view itself, like a CCK email field). You specify if the email should go immediately or in the future and if it is to go in the future whether the view should be regenerated at that time to pick up any changes or whether the view should be 'frozen' so that you would send to exactly the same people the view selects at the time the email is scheduled. I wanted to try to tie it into the actions module to handle the scheduling but never got that far.
Then you use exposed filters on the view to narrow it down to the group that should get an email and type in the message they should get. It used some substitutions from the view so you could tailor the message to include the node title or whatever (and those should be updated to use the Tokens module).
Anyway, it is partly done and it was working at one time for sending the email immediately, but it is very dusty and rusty. If there is interest and no one else has anything better, I can pull it out and see if anyone wants to work on it.
Comment #2
somebodysysop commentedSounds like its worth working on. I'd like to take a look to see if I can get it working.
Comment #3
munga commentedpartially related: http://drupal.org/node/136251
Comment #4
karens commentedI've pulled this out and updated it for 5.x and have it mostly but not completely working. I decided I need it too (the reason I created it in the first place), so I'm going to try to get it more finished and create a project for it. I'll post back here soon with a link.
Comment #5
somebodysysop commentedI've been trying to hack my way through to a solution since I first posted this issue. Could you upload what you have so far, just so I can see how you resolved these issues I can't seem to get past. Thanks!
Comment #6
somebodysysop commentedAlso, along these same lines, can someone please help me with this?: http://drupal.org/node/136196
Comment #7
karens commentedOK, got it mostly working. If there is interest I can create a project for this, but perhaps you planned to create a project of your own?? If so, you can use what I have however you like. I'm not particularly looking for more modules to maintain, so if someone else wants to take this and run, that's fine with me.
Under admin/settings/views_mail you can set it up to operate in test mode which will either display the mail but not actually send it or send it to a test address. Then when it's working right, you can turn test mode off.
Set up any view and give it the View type of 'Views mail'. That will cause it to have a collapsed fieldset on top of the view where you can type in your message. You can send it to the node author, or to a text value in the form like a CCK name or email field. I want to get it working for CCK nodereference fields (to send to the author of the referenced node) and CCK userreference fields (to send to the referenced user), but that part is not completely working.
The biggest problems are with the new 5.x multistep form. It sometimes gets stuck on a step and won't progress. I think I have it mostly working but occasionally still get stuck, but at this point I'm assuming it's because I'm testing this by refreshing the form over and over which isn't really a real world scenario.
Comment #8
somebodysysop commentedBeen working on the module. Have it at least sending e-mails.
There are some typos and other little things that caused errors, but I'm working through them. I decided to take it in a little different direction: Instead of entering the message at the time you create the view, I'm linking it to Simplenews so that you can select a newsletter body to use. I did this because I wanted a way to save my messages as nodes for future use, and this seemed a good way to do it. I'm also using mimemail to send so that I can send full html messages.
I'd like to try and implement the schedule feature. Sounds cool. Can you point me to an example of how you intended to do this? (I don't know anything about the actions module).
I believe I will turn it into a project once I get it fully working. Thanks for your work!
Comment #9
somebodysysop commentedOK, the views_mail tarball is here: http://ftp.scbbs.com/pub/drupal/views_mail/
For those interested, please download, install, and let me know what you think. I'd appreciate all comments as I'm interested in making this a project. The README.txt file is included in the tarball, but I've attached it here as well so you can read up on what I did.
Thanks to KarenS for providing this module!
Comment #10
fagothis is a great functionality - I'd love to see a project for this.
Comment #11
somebodysysop commentedHere's the latest readme for the module which contains some cool new features.
Still interested in comments before I submit as a project.
Comment #12
somebodysysop commentedFinally got a project for Views Mail here: http://drupal.org/project/views_mail
Thanks to the views maintainter for allowing this thread to continue. And, of course, thanks to KarenS for creating and updating the code for me to use.
Comment #13
(not verified) commentedComment #14
ivanbcn commentedThank you very much for this module, I think It's gonna be very useful to me with some adjustments.
I want exactly this, but not sending the newsletter but the result of a view (selecting some nodes filtered by cities) to send local news, but I haven't seen this option here, not in simplenews at the moment...
And something very important, that cost me a couple of days to realize...
If you want to select your view, in the menu: "Views Mail Processing" -> Select View:
You have to edit the View you created (following the steps yo said) but in the "tag" must have: "views_mail"
I was getting mad, until I opened the code and saw the select:
$res = db_query("SELECT name,description FROM {views_view} WHERE tag = 'views_mail' ORDER BY description");
Just, for the newbies in the future....
Comment #15
schnizaare commentedI would really like to use this module. However, it seems that I am unable to use User:Email as the email field to reference. It says it's invalid when I configure the mailing.
Comment #16
joancatala commentedFor Drupal 6.x?
Comment #17
somebodysysop commentedThis issue is closed. I recommend you read the online documentation for views_mail: http://drupal.org/node/644970
Please post any questions / comments regarding the views_mail module in the views_mail module issue queue: http://drupal.org/project/issues/views_mail?categories=All