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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bens at effortlessis dot com
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Tue Mar 19 07:01:29 2024 UTC