is it possible to send a bulk e-mail out to all registered users on my Drupal site?

thanks in advance

Drupal 5.0

Comments

derek.b’s picture

I suggest you install Organic Groups and use that to do the mail out

luno’s picture

Using php compiled as a cgi, write the following to a file called emails.php (changing the details where appropriate for your database):

#!/usr/bin/php -f
<?php
$user="MyDatabaseUser";
$password="MyDatabasePassword";
$database="MyDatabase";
mysql_connect(localhost,$user,$password);
@mysql_select_db($database) or die( "Unable to select database");
$result=mysql_query('select mail from users where uid>1;');
for($i=0;$i<mysql_num_rows($result);$i++) {
  printf("%s\n", mysql_result($result,$i));
}
mysql_close();
?>

When run from the command line of your web server (NOT AS A WEB PAGE!), this will print out all the email addresses of your user table, one per line. Redirect output to a file, and then what you do with them is up to you. ;)

NoahY’s picture