php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53984 mail() regression with sendmail_path containing -f
Submitted: 2011-02-10 16:04 UTC Modified: 2013-02-18 00:34 UTC
Votes:3
Avg. Score:4.7 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (33.3%)
From: danger at freebsd dot org Assigned:
Status: No Feedback Package: Mail related
PHP Version: 5.3.5 OS: FreeBSD, should not depend on OS
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: danger at freebsd dot org
New email:
PHP Version: OS:

 

 [2011-02-10 16:04 UTC] danger at freebsd dot org
Description:
------------
mail() returns false when sendmail_path contains a -f flag and we use additional_params with -f specified again.

This is a regression from 5.3.3 (which I have updated from and discovered the Roundcube stopped being able to send emails).

Additional information:

hosting# php -v
PHP 5.3.5 with Suhosin-Patch (cli) (built: Feb  8 2011 16:36:25)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    with XCache v1.3.1, Copyright (c) 2005-2010, by mOo



Test script:
---------------
--TEST--
mail(): returns false when sendmail_path contains a -f flag and we use additional_params with one
--INI--
sendmail_path=/usr/sbin/sendmail -t -i -f foo@bar.tld
--FILE--
<?php
var_dump(mail('bar@foo.tld', 'subject', 'message', 'From: foo@bar.tld', '-ffoo@baz.tld'));
?>
--EXPECT--
bool(true)

Expected result:
----------------
bool(true)

Actual result:
--------------
hosting# cat mail-test.out
More than one "from" person
bool(false)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-02-10 16:06 UTC] danger at freebsd dot org
Run the script with:

hosting# pear run-tests mail-test.phpt
Running 1 tests
FAIL mail(): returns false when sendmail_path contains a -f flag and we use additional_params with one[mail-test.phpt]
wrote log to "/root/run-tests.log"
TOTAL TIME: 00:00
0 PASSED TESTS
0 SKIPPED TESTS
1 FAILED TESTS:
mail-test.phpt
 [2011-02-13 04:32 UTC] cataphract@php.net
I find this a little hard to believe. Nothing has changed in ext/standard/mail.c between these two versions.
 [2011-02-13 13:12 UTC] danger at freebsd dot org
Did you test the provided code?
 [2011-02-13 16:35 UTC] cataphract@php.net
-Status: Open +Status: Feedback
 [2011-02-13 16:35 UTC] cataphract@php.net
Well, the test is meaningless without you telling which MTA you're using. "sendmail" is provided by several programs.

Can you actually confirm that between the two versions PHP called sendmail in a different fashion (perhaps by making sendmail_path, point to wrapper program that logs the command line and possibly the data passed?). I'm guessing you also changed your MTA when you upgraded PHP.
 [2011-02-14 15:32 UTC] danger at FreeBSD dot org
Hello,

the MTA has not been changed during the upgrade, as I am using Sendmail 8.14.4 which comes with the FreeBSD base system.
 [2013-02-18 00:34 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 [2016-08-23 05:35 UTC] asphp at dsgml dot com
I am experiencing this bug with PHP 5.4.16 and Sendmail 8.14.7.

In php.ini I have sendmail_path defined with -f addr@domain.com, and I called mail() with -f in the 5th parameter.

My intent is to have -f defined in case I don't with mail(), and then override it as needed in mail()

Instead I get the error: more than one "from" person
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Nov 26 22:01:23 2020 UTC