Home » Mail » Mail » Bug #7491
Mail::parseRecipients() not returning PEAR Error
Details
| Submitted | 2006-04-26 11:10 UTC |
|---|---|
| From | dsanders at baselinesolutions dot com dot au |
| Assigned | jon |
| Status | Closed |
| Package | |
| PHP Version | 4.3.10 |
| OS | Linux FC2 |
| Roadmaps | (Not assigned) |
Comments
[2006-04-26 11:10 UTC] dsanders at baselinesolutions dot com dot au
Description:
------------
Not sure if this is known about or not but I stumbled across a case when Mail_sendmail::mail() will return true when sendmail actually fails:
Mail::parseRecipients() only returns arrays, yet the calling functions within the drivers check whether it will return a PEAR Error.
This is not so important to me because sendmail normally catches the fact that no address was passed to it (when parseRecipients returns an empty array) and therefore a PEAR error is raised anyway. However when the -t option is given, sendmail accepts the missing address in the argument list.
I noticed that this was previously touched on with bug #2275, but I believe the suggested fix was to also check parseAddressList() for errors in parseRecipients() and propagate if necessary.
Test script:
---------------
<?php
require_once 'Mail.php';
$headers['From'] = 'xxx@xyz.com';
$headers['Subject'] = 'Example of Mail::send silently failing';
$body = 'Test message ' . date("r") . "\n";
$mailer =& Mail::factory('sendmail');
$mailer->sendmail_args = '-t';
$ret = $mailer->send("some invalid address", $headers, $body);
if (PEAR::isError($ret)) {
echo 'Send failed: ', $ret->getMessage(), "\n";
} else {
echo "Mail sent to $recipients\n";
}
?>
Expected result:
----------------
Send failed: <error message>
Actual result:
--------------
Mail sent to <blank>