#37073 [Opn->Bgs]: From: Header not being parsed correctly in generation of Return-Path header

From: Date: Fri, 14 Apr 2006 11:54:31 +0000
Subject: #37073 [Opn->Bgs]: From: Header not being parsed correctly in generation of Return-Path header
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-95782@lists.php.net to get a copy of this message
ID: 37073 Updated by: sniper@php.net Reported By: junkmail-trash at cowsgo dot mu -Status: Open +Status: Bogus Bug Type: Mail related Operating System: Windows XP / Apache PHP Version: 5.1.2 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. See bug #28038 Previous Comments: ------------------------------------------------------------------------ [2006-04-13 18:40:48] junkmail-trash at cowsgo dot mu $header (line 3) in the example code should read: $header = "From: \"Joe Bob\" <joe@bob.com>\r\n"; to match the output ------------------------------------------------------------------------ [2006-04-13 18:32:10] junkmail-trash at cowsgo dot mu Description: ------------ When using PHP's mail function on Windows, the Return-Path: header is generated by PHP automatically. The value for the header is derived from the From: header supplied by the user. The problem is that if there is a name in the From: header, such as: From: "Joe Bob" <joe@bob.com> PHP will mangle the Return-Path: header as: Return-Path: <"Joe Bob <joe"@bob.com> Some MTAs will then reject the entire email for having an invalid Return-Path header. To observe this, you need to sniff the SMTP connection using a tool like tcpflow, or view the message source if it is delivered correctly. The From: header displayed by your mail client is not an indicator of the Return-Path: header. Please reference http://cr.yp.to/immhf/envelope.html for a nice human-readable interpetation of the relevant RFCs. Reproduce code: --------------- ini_set('SMTP', 'youremailserver.com'); ini_set('smtp_port', '25'); $header = "From: \"Some Guy\" <joe@duh.net>\r\n"; mail("testuser@somesite.com","Test Subject", "Test Message", $header); Expected result: ---------------- (Using Thunderbird's "View Source" option) From - Thu Apr 13 11:26:12 2006 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: <joe@bob.com> Delivered-To: testuser@somesite.com Received: (qmail 29537 invoked from network); 13 Apr 2006 18:26:14 -0000 Received: from localhost (HELO foo) (127.0.0.1) by somesite.com with SMTP; 13 Apr 2006 18:26:14 -0000 Date: Thu, 13 Apr 2006 11:26:04 -0700 Subject: Test Subject To: testuser@somesite.com From: "Joe Bob" <joe@bob.com> Test Message Actual result: -------------- (Using Thunderbird's "View Source" option) From - Thu Apr 13 11:26:12 2006 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 Return-Path: <"Joe Bob <joe"@bob.com> Delivered-To: testuser@somesite.com Received: (qmail 29537 invoked from network); 13 Apr 2006 18:26:14 -0000 Received: from localhost (HELO foo) (127.0.0.1) by somesite.com with SMTP; 13 Apr 2006 18:26:14 -0000 Date: Thu, 13 Apr 2006 11:26:04 -0700 Subject: Test Subject To: testuser@somesite.com From: "Joe Bob" <joe@bob.com> Test Message ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=37073&edit=1

« previous php.bugs (#95782) next »