#29122 [Com]: mail function ignoring -f arg as 5th argument

From: Date: Fri, 23 Jul 2004 12:24:17 +0000
Subject: #29122 [Com]: mail function ignoring -f arg as 5th argument
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-63418@lists.php.net to get a copy of this message
 ID:               29122
 Comment by:       lgm2 at noos dot fr
 Reported By:      brian dot foddy at nwa dot com
 Status:           Open
 Bug Type:         Mail related
 Operating System: Solaris 2.8
 PHP Version:      5.0.0RC3
 New Comment:

Fix from gem at rellim dot com is fine.

Thanks.


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

[2004-07-23 14:15:19] lgm2 at noos dot fr

Same problem with PHP5.0.0 under redhat.

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

[2004-07-23 01:34:13] gem at rellim dot com

Found the problem(s).  

I had exactly the same problem.  Setting the 5th parm to "-fxxx" works
perfectly in 4.3.6, It also works perfectly from command line.  PHP
Fails to use "-f" since I updated to 5.0.0.

A diff of the old code in ext/standard/mail.c shows the new
mail.force_extra_parameters option but no other obvious related
changes.

Safe Mode=On would kill the 5th parameter, but that is off.
mail.force_extra_parameters is empty.

Forcing mail.force_extra_parameters to -fxxx in php.ini does not work.

BTW, that parameter is MISSPELLED in the sample config files
php.ini-dist and php.ini-recommended as well as the NEWS file.

AHH, there is the problem this line:
char *force_extra_parameters = INI_STR("mail_force_extra_parameters");

Should read this way:

char *force_extra_parameters = INI_STR("mail.force_extra_parameters");

Notice the mail_force should be mail.force.  Stupid typo!

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

[2004-07-14 21:19:11] brian dot foddy at nwa dot com

I hope this is what you want...
I changed the external TO address from
brian.foddy to "a26811" which is my
local user id on the server in question,
so the local sendmail did no further forwarding
or sending to external hosts.  The resulting
full message looks like:
============================================
From apache Wed Jul 14 19:14:27 2004
Return-Path: <apache>
Received: (from apache@localhost)
        by f1xsds01.mn.nwa.com (8.11.7p1+Sun/8.11.7) id i6EJEQ218348;
        Wed, 14 Jul 2004 19:14:26 GMT
Date: Wed, 14 Jul 2004 19:14:26 GMT
Message-Id: <200407141914.i6EJEQ218348@f1xsds01.mn.nwa.com>
To: a26811
Subject: Subject line
From: brian.foddy@nwa.com
X-Sender: xsender@nwa.com
X-Mailer: PHP/5.0.0RC3
Mailing-List:  SOC Issue Tracking - Mantis
Content-Type: text/plain; charset=iso-8859-1
Content-Length: 55
Status: RO


This is a test message.
Wed Jul 14 14:14:26 CDT 2004
===================================

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

[2004-07-14 17:58:29] curt@php.net

you're workaround is exactly how php's mail() sends the data, minus the
ini setting to use -t -i.  So I dont see how a different return path is
being sent.

Looking at your headers, it does seem suspect that return-path isn't
the first line, It appears that mozilla is doing some header mangling.


Can you obtain the raw headers that are being set?


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

[2004-07-14 05:49:02] brian dot foddy at nwa dot com

The results as requested:
From= [me@localhost.com]
Path = [/usr/lib/sendmail -t -i]

Yes, it supports the -f option, my temporary workaround was
the following code snippet instead of calling mail()
$tmp_msg_string = "To: $t_recipient\nSubject: 
$t_subject\n$t_headers\n\n$t_message\n";
$tmp_handle = popen ("/usr/lib/sendmail -fapache@nwa.com $t_recipient",
"w");
fwrite ($tmp_handle, $tmp_msg_string);
$result = pclose ($tmp_handle);

which worked fine as expected.

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

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://bugs.php.net/29122

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


Thread (10 messages)

« previous php.bugs (#63418) next »