|  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
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:
$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:
... 10,000 times. 

Actual result:
... typically less than 100 times, and then browser times out. 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-06-29 18:05 UTC]
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 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-2022 The PHP Group
All rights reserved.
Last updated: Wed Nov 30 03:03:45 2022 UTC