> the combination of PHP and mysql and the ease of use of the mail() > function obviously leads me to believe that it *should* be a cinch to > use php to send customised messages to all my users , of whom I have > details in a mysql table by simply running a "select * from table" and > then using a while loop to run through every row and sending an e_mail > to $user_in_table.
You don't want to use the mail() function. It will take forever to send 17,000 messages since PHP will wait for each message to be delivered before sending the next one. With DNS lookups, slow remote servers, etc., it can take a long time to send each message. A better solution on *nix machines with sendmail is to write the messages into the mail queue and use "sendmail -q" to send them out. (If sendmail is running as a daemon, it's probably already configured with "-bd -q15m" or a similar set of command line switches. Otherwise you'll need a line in /etc/crontab that runs "sendmail -q" as root throughout the day.) Here's a sample that writes each message into the queue assuming the appropriate values for each addressee are stored in $from, $to, $subject, and $message. You'd obviously embed this is an iteration loop. # you probably want a sender to handle bounces $sender="[EMAIL PROTECTED]"; ### LOOP OVER THESE # complete sendmail command; note that this must be in the iteration # loop to fill in $sender and $name for each recipient $sendmail="/usr/sbin/sendmail -odq -t -i -f$sender '$name'"; # construct the header $headers= "Sender: $sender From: $from To: $to Subject: $subject "; # mail the message (write to sendmail socket; queue for delivery) $sm=popen($sendmail,"w"); fputs($sm,$headers); fputs($sm,$message); pclose($sm); ### END OF LOOP ### Good luck! Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php