|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull Requests |
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 08:00:02 2025 UTC |
When sending mail to an email address including special characters (i.e. ???) using PEAR's Mail send(), an error is not returned but an email sent to the local postmaster account. While the following command sends an email to "?var@example.com" (and allows the MTA to do the error handling) <?php mail("?var@example.com", "Test 1", "Using mail()") ?> .. the following example code (taken from http://pear.php.net) sends an error to the local postmaster account. <?php include('Mail.php'); $recipients = '?var@example.com'; $headers['From'] = 'me@myhost.com'; $headers['To'] = $recipients ; $headers['Subject'] = 'Test 2'; $body = 'Using PEAR\'s send()'; $params['sendmail_path'] = '/usr/local/sbin/sendmail'; // Create the mail object using the Mail::factory method $mail_object =& Mail::factory('sendmail', $params); $mail_object->send($recipients, $headers, $body); ?> I have played a little with the PEAR code and traced the problem to a regular expression match in Mail/RFC822.php, line 518. if (!preg_match('/^[\\x00-\\x7E]+$/i', $atom, $matches)) { return false; } I have red *some* of RFC822 and know that ASCII characters above 127 are not allowed (correct ?), but shouldn't PEAR either a) Return an error b) Pass the message along to the MTA like mail() .. instead of the message going to the local postmaster without notifying the sender ?