PHP List,
I have a database of about 120 users. Each weak I send out a newsletter.
So far as I know, it's been working fine for the last couple of years.
Then recently some users emailed me to let me know that they haven't
been receiving all the messages. I added extra output to my script to
echo out the name of each member that got an email sent to them, and I
can now see that only about 50 of them are getting the email.
The only think that has changed that I can think of is that I've
upgraded to MySQL 5.0. However, given the type of problem I'm having, I
don't think it's a MySQL problem, it appears much more likely to be a
problem with my PHP code.
This is the script that sends out the message (edited slightly to take
out irrelevant bits of newsletter content):
- - - -
$count = 0;
while ( $member = mysql_fetch_row($result) )
{
set_time_limit(0);
$subject = "Newsletter subject line";
$mailcontent = "This message was sent to " . $member[0] . " at {$member[1]}
Blah, blah, blah - newsletter content goes here.";
mail($member[1], $subject, $mailcontent, $fromaddress);
$count++;
echo "<p>Newsletter sent to " . $member[0] . " at " . $member[1] . "</p>";
}
echo "<p>A total of " .$count ." emails were sent out.</p>\n";
- - - -
The script actually dies before it gets to the last echo which echoes
the value of $count. It outputs about 50 lines of "Newsletter sent to
usersname at name@xxxxxxxxx" and then the cursor is stuck in hourglass
mode and the browser is continually waiting a response. It stays like
that indefinitely, and the only way it stops is if I go to another page
or shut down the browser.
I have heard that the mail() function does have limitations on how many
emails it sends out. But I thought it took hundreds, somewhere between
500 and a thousand, of individual emails before it would die. And I also
thought the set_time_limit(0) function would alleviate the problem of
timing out.
Where have I gone wrong with this?
Any advice would be greatly appreciated. Thank you for taking the time
to read this.
--
Dave M G
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php