Jon Abernathy wrote:
> After reviewing your code, I was wondering if there was a reason you aren't
> using PHP's built-in mail() function, rather that using popen() and a series
> of fputs(), which seems rather expensive, especially inside of a loop. Also,
Sounds like a much better idea, looking at the mail() function. I'm
more familiar with using sendmail etc., so I gravitated towards that - I
should have examined my options more thoroughly.
> you only need to use set_time_limit() once, outside of your loop-- pass 0 as
> the parameter, which basically turns off the timeout.
Ahh, really. That's interesting - I'd assumed that this wouldn't work
as it would allow a badly-written script to get itself into some kind of
infinite loop easier - but I'm sure you're right.
> Here's how I would code this:
>
> $counter = 0;
> set_time_limit(0);
> if ( $fp = fopen($list, 'r') ) {
> while ( $address = fgets($fp, 255) ) {
> mail( $address, $subject, "header goes here\n$body\nfoot goes
> here\n", "From: Sender <[EMAIL PROTECTED]>\n" );
> $counter++;
> }
> fclose( $fp );
> print("Message successfully sent to $counter recipients from the
> $list");
> }
Much more concise - thanks.
> Hope this helps.
Indeed it does - thank you (again) very much!
A.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php