PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Mail » Mail_Queue » Bug #6538

Error on mail send causes infinite send loop

Details

Submitted2006-01-20 12:50 UTC
Fromnyeholt at gmail dot com
Assignedquipo
StatusClosed
PackageMail_Queue
PHP Version4.3.11
OSRHEL 4
Roadmaps(Not assigned)

Comments

[2006-01-20 12:50 UTC] nyeholt at gmail dot com

Description:
------------
The method sendMailsInQueue can get into an infinite loop if there's a send error (and the application doesn't break out on a NOTICE error for some reason, like an overloaded error_handler) as the errornous mail isn't removed from the queue, and is the next one returned from $this->get(). This loops until you start receiving errors from Net::Socket when it gets its connects dropped by the mail server.

Test script:
---------------
Possible fix

if (!PEAR::isError($result)) {
$this->container->setAsSent($mail);
if($mail->isDeleteAfterSend()) {
$this->deleteMail($mail->getId());
}
} else {
PEAR::raiseError(
'Error in sending mail: '.$result->getMessage(),
MAILQUEUE_ERROR_CANNOT_SEND_MAIL, PEAR_ERROR_TRIGGER,
E_USER_NOTICE);
if($mail->isDeleteAfterSend()) {
$this->deleteMail($mail->getId());
}
}

Or just $this->deleteMail($mail->getId());

Expected result:
----------------
Mail is removed from the queue, subsequent emails processed.

Actual result:
--------------
2006-01-20 07:21:39][12:Root User][1024:mysource notice][R] (/usr/share/pear/PEAR.php:763) - Error in sending mail: Failed to send data [SMTP: Invalid response code received from server (code: 554, response: Error: no valid recipients)]
[2006-01-20 07:21:39][12:Root User][8:php notice][R] (/usr/share/pear/Net/Socket.php:295) - fwrite(): send of 37 bytes failed with errno=32 Broken pipe
[2006-01-20 07:21:39][12:Root User][8:php notice][R] (/usr/share/pear/Net/Socket.php:295) - fwrite(): send of 6 bytes failed with errno=32 Broken pipe