ID: 37073 User updated by: junkmail-trash at cowsgo dot mu Reported By: junkmail-trash at cowsgo dot mu Status: Open Bug Type: Mail related Operating System: Windows XP / Apache PHP Version: 5.1.2 New Comment:
$header (line 3) in the example code should read: $header = "From: \"Joe Bob\" <[EMAIL PROTECTED]>\r\n"; to match the output Previous Comments: ------------------------------------------------------------------------ [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" <[EMAIL PROTECTED]> 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\" <[EMAIL PROTECTED]>\r\n"; mail("[EMAIL PROTECTED]","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: <[EMAIL PROTECTED]> Delivered-To: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] From: "Joe Bob" <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] From: "Joe Bob" <[EMAIL PROTECTED]> Test Message ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=37073&edit=1