Home » Mail » Mail » Bug #2275
Address typo makes Mail_sendmail::send silently drop mail with no error
Details
| Submitted | 2004-09-03 16:01 UTC |
|---|---|
| From | mic at uts dot cc dot utexas dot edu |
| Assigned | chagenbu |
| Status | Closed |
| Package | |
| PHP Version | 4.3.8 |
| OS | FreeBSD |
| Roadmaps | (Not assigned) |
Comments
[2004-09-03 16:01 UTC] mic at uts dot cc dot utexas dot edu
Description:
------------
Using Mail::send with the 'sendmail' driver, submitting addresses with a `.' or `,' at the end of the hostname, such as
foo@bar.baz.
result in passing a message with zero-length recipient list to the mail system. No errors are returned, so the calling program (in this case IMP) logs a successful message submission. However, the mail is never delivered to the intended recipients.
This only happens with addresses that fail the validation done in Mail_RFC822:parseAddresslist. Adding a period to a hostname is simply the first instance reported to us.
We think this happens because Mail::parseRecipients is not checking for a PEAR_Error return object when it calls Mail_RFC822::parseAddressList. When a PEAR_Error is returned due to a bad address, the is_array() check on line 180 fails. An empty array of recipients is then silently returned to the caller, and the mail system happily accepts a moot message.
The enclosed patch provides a simple and hopefully stylistically correct check for PEAR errors in the relevant parts of Mail::parseRecipients and Mail_sendmail::send. With these changes, the test program observes and reports the address parsing error.
We have also confirmed that with this patch in place, IMP reports an address validation problem to the user, and logs it in horde.log. The message is not sent, but the user is aware of the fact and can correct the address. That is much more preferable than mysterious mail nondelivery!
Configuration: PHP 4.3.8 with Mail 1.1.3. PHP is compiled as follows:
./configure' '--with-openssl=/usr/local/openssl' '--with-imap=/usr/local/libc-client' '--with-imap-ssl=/usr/local/openssl' '--with-ldap=/usr/local/openldap' '--with-xml' '--with-dom=/usr/local' '--with-dom-xslt=/usr/local' '--with-dom-exslt=/usr/local' '--with-curl=/usr/local' '--with-mhash=/usr/local' '--enable-dba' '--with-db4=/usr/local/db-4.1.25' '--with-flatfile' '--with-iconv=/usr/local/include' '--enable-mbstring' '--with-gd' '--with-png-dir=/usr/local/lib' '--with-jpeg-dir=/usr/local/lib' '--with-zlib-dir=/usr/lib' '--with-mysql' '--with-mm' '--with-mcrypt=/usr/local/libmcrypt' '--with-gettext' '--enable-debug' '--enable-calendar' '--prefix=/usr/local/php-4.3.8' '--enable-discard-path'
Our php.ini is empty aside for loading a locally written extension that is not used in this circumstance.
Reproduce code:
---------------
Test program: http://uts.cc.utexas.edu/~mic/php/Mail-patch/test.php.txt
Patch:
http://uts.cc.utexas.edu/~mic/php/Mail-patch/patch
Expected result:
----------------
The expected result is for the mail message to be delivered as specified by the recipient list.
Actual result:
--------------
The actual result is an entry in the mail system logs with a sender address but no recipients. The message is never received.