That's a good question and one that I have too. As far as I know mail() is supposed to utilize sendmail...
-----Original Message----- From: Anzak Wolf [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 10, 2002 7:27 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP] mailing list using mail() > > > 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 ### > > I have a question with regards to this. From reading the docs on mail() it seems that the mail function just opens a socket to sendmail on your local system anyway. So how does forcing the same sort of action help in this case. I'm trying to get a firm grasp around this whole email/sendmail/sockets thing. -Jim _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php