----- Original Message ----- From: "Lowell Allen" <[EMAIL PROTECTED]> To: "PHP" <[EMAIL PROTECTED]> Sent: Monday, February 03, 2003 10:37 AM Subject: [PHP] tracking bulk email
> I've added an email feature to a content management system that will send > plain text email to about 1400 contact addresses. Each contact is sent a > separate email with the contact name and address in the "To:" header. It > works fine to small test lists, but hasn't been tested with a large list. > > Although I think list posts should only pose one question, I have two: > > (1) My client is nervous about the script failing mid-list and not being > able to determine which contacts were sent mail. I need a way to build this > check into the content management system. I could write a flag to the > database every time mail() returns true, but that would mean 1400 database > updates! If I instead append to a variable each time through the mail() > loop, I'll lose the record if the script times out. Can anyone suggest a way > to record the position in a loop if a time out or failure occurs? > (2) In order to avoid the script timing out, I'm counting the number of > mail() attempts and calling set_time_limit(30) every 50 attempts to provide > another 30 seconds of script execution time. I'm on a commercial Linux host, > PHP 4.1.2, phpinfo.php shows the configuration command includes > '--enable-safe-mode', but the directive safe_mode is "Off". I'm building a > test list with over 100 messages, but has anyone done something similar to > prevent the script timing out when sending lots of mail? > Thanks. > > -- > Lowell Allen In response to your first question. File stores are something a computer does very very fast (might want to add some error catching to this).. $i=0 while() { count_index($i) $i++; } function count_index ($i) { $fp = fopen('count.txt', 'w'); fwrite($fp, $i); fclose($fp); } In response to your second question. Sure provided you're not outputting anything you can do header('Location: myscript.php'); every 25 - 30 seconds to relaunch the script. Open your log file and start from the printed value. - Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php