I'm trying to find out if there is a module that let's me send out a bulk email notification to all users on my drupal site. I know about the subscription module but that's not exactly what I have in mind. I'm looking for just a form on the administration pages that allows me to send an email to the users of the site.

It doesn't seem like it would be too hard to implement I just don't want to reinvent the wheel.

Comments

nedjo’s picture

...here and here. Specifically, killes suggested looking at portions of the devel.module, http://drupal.org/project/devel. A module for sending email to users, with ability to filter mail sent by role and profile parameters would be useful...

nedjo’s picture

I've drafted a quick module for emailing users, see

http://cvs.drupal.org/viewcvs/contributions/modules/mail/.

JoeCotellese’s picture

Thanks, I'll check it out.

Joe Cotellese
FWScan-You Are Vulnerable-

mgifford’s picture

This is an ancient post, but figured since I got here via a search engine others might too. I think the current modules for doing this are presently:
http://drupal.org/project/mass_contact
http://drupal.org/project/advuser

I haven't used either of them yet, but plan to use advuser soon. Both are beta as of Jan 2008.

Mike
--
OpenConcept | SEO | Tech | Screencasts

Teerr’s picture

I got this page from google!

Thanks a lot man.. I am looking for the same.

THANK YOU

N.Simpson’s picture

I found this from Google too. Was looking for a 6.x solution. I'll post back here if I find one soon.

wwwoliondorcom’s picture

Drupal 6 email users module ?

Hi, I am also looking fo a Drupal 6 solution, any news ?

Thanks.

WorldFallz’s picture

From 3 comments up: http://drupal.org/project/mass_contact

===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz

KingMoore’s picture

the mailout module should do what you want

http://drupal.org/project/mailout

N.Simpson’s picture

Not for D6 yet though...

klaasvanschelven’s picture

Also in need for a D6 version of *any* of these modules. Anyone up to speed on how to supply the corresponding requests?

roquestrew’s picture

I'm wondering if this is possible, too. What a great module that'd be!

haydeniv’s picture

You may want to check out the Mass Contact Module
Just don't forget to read the info about the module. I missed the line that the menu item is disabled by default. Took me a little bit to find that.

Jon Heaton

klaasvanschelven’s picture

This is my drupal 6 solution. No packaging, code standards and whatnot. Only one option: send mail to all. No variables. It works for me though... Please let me know if you have any improvements (including packaging, which you're free to do)

Create a folder "bulkmail" under sites/all/modules
Paste in two files:

bulkmail.info

name = Bulkmail
description = Send a mail to all users.
core = 6.x

bulkmail.module


function bulkmail_perm() {
    return array('access bulkmail content');
}

function bulkmail_menu() {
    $items = array();
    $items['bulkmail'] = array(
        'title' => t('Send Bulk Mail'),
        'page callback' => 'drupal_get_form',
        'page arguments' => array('bulkmail_form'),
        'access arguments' => array('access bulkmail content'),
        'type' => MENU_NORMAL_ITEM,
    );
    return $items;
}

function bulkmail_form() {
    $form['subject'] = array(
        '#type' => 'textfield',
        '#title' => t('Subject'),
        '#required' => TRUE,
    );
    $form['body'] = array(
        '#type' => 'textarea',
        '#title' => t('Body'),
        '#required' => TRUE,
    );
    $form['submit'] = array(
        '#type' => 'submit',
        '#value' => t('Send')
    );

    return $form;
}

function bulkmail_form_submit($form, &$form_state) {
    $params = array();
    $params['subject'] = $form_state['values']['subject'];
    $params['body'] = $form_state['values']['body'];

    $result = db_query("SELECT mail FROM {users}");
    while ($user = db_fetch_object($result)) {
        drupal_mail('bulkmail', 'ignored', $user->mail, language_default(), $params, NULL, TRUE);
    }
    drupal_set_message(t('Your message has been sent.'));
}

function bulkmail_mail($key, &$message, $params) {
    $message['subject'] = $params['subject'];
    $message['body'] = $params['body'];
}


Have fun with it. If this was useful to you and you feel like doing something back, you could recommend me on LinkedIn
http://www.linkedin.com/in/klaasvanschelven ([become linkedin member] > make friends with me > write a nice recommendation)

cem kaan’s picture

Yes, it works but I disabled module after I used it.

no_idea_yet’s picture

Hi, this looks interesting. I've created the directory and the two files, enabled the module . . . now what? How do I actually compose and send an email?

Regards
H

klaasvanschelven’s picture

As far as I know it should give you a menu item... "Send Bulk Mail" but you may have to activate it in "menus"

--
Klaas van Schelven
Open Source and Open Standards (Dutch)

no_idea_yet’s picture

That's embarrassing!

Thanks klaasvanschelven for pointing me in the right direction, it is in fact in there, enabled by default . . . just not in the menu I expected and for some reason, until checking again just now, couldn't find it!

Much appreciated :)

Bob Stein’s picture

One more thing you may want to keep in mind. When I first used the module, I had to set up TWO contact groups (even though I had only one subset of registered users I needed to send bulk email to) before it would send an email.

When I set up the first list and tried sending an email, it acted like it worked, but it didn't. So I set up a second (dummy) list, which then prompts a selectbox option when you're composing the email. Apparently something in the module needs to have the selectbox available to actually send the email.

If my explanation doesn't make sense, or if your experience was different, let me know.

mattwmc’s picture

Where is it located?

sitebuilding/menus or admin/build/menu?

Its not there for me.

vm’s picture

both locations you've used as an example are the same. One is the breadcrumb navigation and the other is the actual path for the menu module administration area. Based on your examples, you only went to the administration area for menus and haven't investigated deeply enough inside each menu. Check each menu in your menus admin UI for the menu item provided the module in question.

mattwmc’s picture

Ok found it. It was in the Navigation Menu.

Strange place for it, I would think.

Thanks!

vm’s picture

navigation menu is where the administration menu is by default. The menu item in the module discussed would require being displayed in a menu that is guaranteed to be there. Which the navigation menu is since it's a default menu.

cozzi’s picture

This look interesting, but my hosting provider has a limit of 500 emails/hour. I think this module would try to send to all of my (2K) accounts at once, yes/no? In which case 1500 messages would hit the dirt.

WorldFallz’s picture

I believe that's one of the issues the http://drupal.org/project/queue_mail module is aimed at alleviating.

vimalramaka’s picture

I have created those two files and activated the module, but became the reason for errors in my server. I prefer to say that, please don't go for this. This method creates, internal server errors.

gajanannehul’s picture

warning: mail() [function.mail]: SMTP server response: 503 Bad sequence of commands. You must specify the recipients of a message before you can send it in D:\inetpub\vhosts\raintekdev.com\subdomains\hasaleko\httpdocs\includes\mail.inc on line 192.
Unable to send e-mail. Please contact the site administrator if the problem persists.
but mail send suceesfully. i am working on jokes site and i want to send one joke to each user daily Please help me how i send this automatically with your code...

halfabrain’s picture

Thanks klaasvanschelven for a great script. Is it possible to amend this so that it sends emails to all a users "friends" or "fans" as determined by the user-relationships module?
H

WorldFallz’s picture

You might be able to use http://drupal.org/project/views_mail for that.

halfabrain’s picture

Thanks WorldFallz. I followed your suggestion but I cannot get my head around how this module works. I appreciate that the author of the module has said he needs time to write up documentation for it, so I guess I'll sit tight and wait for it to appear.

Thanks for the suggestion though,

H

OSDIcompany’s picture

try this http://cvs.drupal.org/viewcvs/contributions/modules/mail/.

may be this is best solutions as per your need