What about making the log a .txt file and not a database?  Wouldnt that be
quicker?

Leonard.

-----Original Message-----
From: Lowell Allen [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 04, 2003 7:27 AM
To: PHP
Subject: Re: [PHP] tracking bulk email


> From: "Kevin Stone" <[EMAIL PROTECTED]>
>
> ----- Original Message -----
> From: "Lowell Allen" <[EMAIL PROTECTED]>
>
>> 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 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
how
>> 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.

[snip]

> 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);
> }

Thanks, Kevin. I've put a counter in place within my mail loop. It seems to
slow the process, but perhaps not too much. And thanks to Mark McCulligh for
describing a system for sending about 1500 messages that's called with a
cron tab and writes to a db after each mail. And thanks to Chris Hayes for
pointing to relevant list archives. My system seems to be working, but it's
so slow that I'm going to look at using a cron tab and saving everything to
a database for easier reference in case of failure mid-list.

--
Lowell Allen


--
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

Reply via email to