|  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
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
Have you experienced this issue?
Rate the importance of this bug to you:

 [2011-02-10 16:04 UTC] danger at freebsd dot org
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:
mail(): returns false when sendmail_path contains a -f flag and we use additional_params with one
sendmail_path=/usr/sbin/sendmail -t -i -f foo@bar.tld
var_dump(mail('bar@foo.tld', 'subject', 'message', 'From: foo@bar.tld', '-ffoo@baz.tld'));

Expected result:

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


Add a Patch

Pull Requests

Add a Pull Request


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"
 [2011-02-13 04:32 UTC]
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]
-Status: Open +Status: Feedback
 [2011-02-13 16:35 UTC]
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

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, 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 Oct 29 14:01:44 2020 UTC