php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28914 Mail() hangs when sending large amounts of email
Submitted: 2004-06-25 01:05 UTC Modified: 2004-06-29 18:05 UTC
From: bens at effortlessis dot com Assigned:
Status: Not a bug Package: Mail related
PHP Version: 4.3.7 OS: Red Hat FC1
Private report: No CVE-ID: None
 [2004-06-25 01:05 UTC] 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. 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-06-29 18:05 UTC] iliaa@php.net
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. 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Oct 05 09:01:27 2024 UTC