#28914 [Opn->Bgs]: Mail() hangs when sending large amounts of email

From: Date: Tue, 29 Jun 2004 16:05:23 +0000
Subject: #28914 [Opn->Bgs]: Mail() hangs when sending large amounts of email
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-61503@lists.php.net to get a copy of this message
ID: 28914 Updated by: iliaa@php.net Reported By: bens at effortlessis dot com -Status: Open +Status: Bogus Bug Type: Mail related Operating System: Red Hat FC1 PHP Version: 4.3.7 New Comment: Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Thank you for your interest in PHP. This is a problem with your mailserver. It slows down with large number of e-mails in the queue and eventually the browser timesout because it takes too long to get the output. You may want to monitor your e-mail log and the server load while running the script to determine the cause of the slowdown. Previous Comments: ------------------------------------------------------------------------ [2004-06-25 01:05:19] bens at effortlessis dot com Description: ------------ When used repeatedly, in a loop, mail() will often hang causing the script and/or browser to timeout. Sometimes the script will continue to execute after the browser times out, causing all sorts of grief. I've tested this on numerous (RedHat 7.x through RH FC1) servers, and have seen the same issue since at least PHP 4.2.x. (Just crossed my mind to report this as a bug!) Reproduce code: --------------- <? set_time_limit(0); $header="From: mlist@domain.com"; $sql="SELECT email FROM list ORDER BY email ASC"; if ($res=pg_exec($dbconn, $sql)) while ($row=@pg_fetch_array($res)) { echo $row['email']."<BR>\n"; mail($row['email'], 'Mailing List News', $msg, $header); } ?> Expected result: ---------------- user@domain.com user@domain.com user@domain.com ... 10,000 times. Actual result: -------------- user@domain.com user@domain.com user@domain.com ... typically less than 100 times, and then browser times out. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=28914&edit=1

« previous php.bugs (#61503) next »