ID:               45305
 Updated by:       [EMAIL PROTECTED]
 Reported By:      php at info-svc dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Mail related
 Operating System: Windows Server 2003 SP2
 PHP Version:      5.2.6
 New Comment:

Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.




Previous Comments:
------------------------------------------------------------------------

[2008-06-25 18:19:54] php at info-svc dot com

Related research:
#28038
#32600
#33507
#37073
#43730
#45249

------------------------------------------------------------------------

[2008-06-19 02:38:17] php at info-svc dot com

sendmail.c @ 265

                /* Real offset is memaddress from the original headers + 
difference
of
                 * string found in the lowercase headrs + 5 characters to jump 
over  

                 * the from: */
                pos1 = headers + (pos1 - headers_lc) + 5;
                if (NULL == (pos2 = strstr(pos1, "\r\n"))) {
                        RPath = estrndup(pos1, strlen(pos1));

This assumes there is always a valid addr-spec sandwiched between
"\nFrom:" and "\r\n" inside the additional_headers value.  But in RFC
2822 the From header is defined as mailbox-list.  So, the RPath
assignment in sendmail.c needs to detect both name-addr and addr-spec
formats in the From header.

------------------------------------------------------------------------

[2008-06-19 01:50:05] php at info-svc dot com

I found the advanced logging options :)  Here is an excerpt:

#Fields: time c-ip cs-method cs-uri-query 
01:44:24 192.168.4.8 MAIL +FROM:<[EMAIL PROTECTED]>
01:44:24 192.168.4.8 RCPT +TO:<[EMAIL PROTECTED]>

01:44:24 192.168.4.8 MAIL
+FROM:<Robert+Chapin+<[EMAIL PROTECTED]>>

01:44:24 192.168.4.8 MAIL +FROM:<>
01:44:24 192.168.4.8 RCPT +TO:<[EMAIL PROTECTED]>

01:44:24 192.168.4.8 MAIL +FROM:<>
01:44:24 192.168.4.8 RCPT +TO:<[EMAIL PROTECTED]>

------------------------------------------------------------------------

[2008-06-19 01:03:56] php at info-svc dot com

Notice the SMTP error can never be reproduced if the following
statement comes before mail()

ini_set('sendmail_from', ini_get('sendmail_from'));

This is a good workaround until the bug is fixed.

------------------------------------------------------------------------

[2008-06-19 00:42:39] php at info-svc dot com

Description:
------------
PHP fails to parse the From: header in mail()'s additional_headers
parameter when all of the following conditions exist:

* Header is in the form of From: Name <address>
* Script does not call ini_set('sendmail_from')
* php.ini does not configure sendmail_from

As the test server is using the localhost smtp service I can't see the
smtp session using Network Monitor.  The error returned by PHP is shown
below.  If there is a way for me to show you the bad MAIL TO command
just let me know how.

Reproduce code:
---------------
ini_set('display_errors', TRUE);
echo 'Sending message 1<br />';
mail('[EMAIL PROTECTED]', 'Test Message1', 'Does the From header work
at all?', 'From: [EMAIL PROTECTED]');
echo 'Sending message 2<br />';
mail('[EMAIL PROTECTED]', 'Test Message2', 'Does the From header work
at all?', 'From: Robert Chapin <[EMAIL PROTECTED]>');
ini_set('sendmail_from', NULL);
echo 'Sending message 3<br />';
mail('[EMAIL PROTECTED]', 'Test Message3', 'Does the From header work
at all?', 'From: [EMAIL PROTECTED]');
echo 'Sending message 4<br />';
mail('[EMAIL PROTECTED]', 'Test Message4', 'Does the From header work
at all?', 'From: Robert Chapin <[EMAIL PROTECTED]>');


Expected result:
----------------
Sending message 1
Sending message 2
Sending message 3
Sending message 4

Actual result:
--------------
Sending message 1
Sending message 2

Warning: mail() [function.mail]: SMTP server response: 501 5.5.4
Invalid Address in test.php on line 5
Sending message 3
Sending message 4



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=45305&edit=1

Reply via email to