Bug #13931 [Fbk->NoF]: Does not allow perfectly good 'From' address
| From: | daniel dot oconnor at gmail dot com | Date: | Mon, 23 Mar 2009 17:07:10 +0000 |
| Subject: | Bug #13931 [Fbk->NoF]: Does not allow perfectly good 'From' address | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-247@lists.php.net to get a copy of this message | ||
Edit report at http://pear.php.net/bugs/bug.php?id=13931&edit=1
ID: 13931
Updated by: daniel.oconnor@gmail.com
Reported By: message at ptd dot net
Summary: Does not allow perfectly good 'From' address
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: Mail
Operating System: Linux RedHat Enterprise
Package Version: 1.2.0a2
PHP Version: 5.2.4
Roadmap Versions:
New Comment:
-Status: Feedback
+Status: No Feedback
Previous Comments:
------------------------------------------------------------------------
[2008-10-05 13:43:10] doconnor
Thanks for the patch, Tomasz, but without an executable test case that
clearly demonstrates the problem, people not familiar with the package
would feel a little reluctant to apply it.
Though if you could put one together ... :)
------------------------------------------------------------------------
[2008-09-04 10:18:14] tomaszrup
Patch (I can't add him by the "Add a Patch"):
--- Mail-1.2.0b1/Mail/sendmail.php 2008-07-02 08:24:39.000000000
+0200
+++ Mail-1.2.0b1-patch-13931/Mail/sendmail.php 2008-09-04
16:24:43.000000000 +0200
@@ -134,19 +134,23 @@
if (!isset($from)) {
return PEAR::raiseError('No from address given.');
- } elseif (strpos($from, ' ') !== false ||
- strpos($from, ';') !== false ||
+ } elseif (strpos($from, ';') !== false ||
strpos($from, '&') !== false ||
strpos($from, '`') !== false) {
return PEAR::raiseError('From address specified with
dangerous characters.');
}
- $from = escapeShellCmd($from);
+ $_from = Mail_RFC822::parseAddressList($from, 'localhost',
false);
+ $_from = $_from[0];
+ $from = escapeShellCmd($_from->mailbox . '@' . $_from->host);
$mail = @popen($this->sendmail_path .
(!empty($this->sendmail_args) ? ' ' . $this->sendmail_args : '') . "
-f$from -- $recipients", 'w');
if (!$mail) {
return PEAR::raiseError('Failed to open sendmail [' .
$this->sendmail_path . '] for execution.');
}
+ if (!empty($_from->personal)) {
+ $text_headers .= $this->sep.$_from->personal . ' <' .
$_from->mailbox . '@' . $_from->host . '>';
+ }
// Write the headers following by two newlines: one to end the
headers
// section and a second to separate the headers block from the
body.
fputs($mail, $text_headers . $this->sep . $this->sep);
------------------------------------------------------------------------
[2008-09-04 09:53:02] tomaszrup
The sendmail -f parameter accept only email address. To describe the
field "From" sendmail use parameter -F
Mail/sendmail.php use only -f parameter.
------------------------------------------------------------------------
[2008-09-04 07:28:16] tomaszrup
Mail/sendmail.php line 141
------------------------------------------------------------------------
[2008-05-18 10:44:07] chagenbu
We are unable to reproduce the bug as reported.
Please provide a simple script (10 lines or less)
or a link to an external script that can be used
to reproduce the bug.
If you can provide the script, feel free to add it
to this bug and change the status back to "Open".
Thank you for your interest in PEAR.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://pear.php.net/bugs/bug.php?id=13931
--
Edit this bug report at http://pear.php.net/bugs/bug.php?id=13931&edit=1