Bug #73934 [Fbk->Opn]: Envelope Sender (-f) no longer working?
Edit report at https://bugs.php.net/bug.php?id=73934&edit=1
ID: 73934
User updated by: core905 at gmail dot com
Reported by: core905 at gmail dot com
Summary: Envelope Sender (-f) no longer working?
-Status: Feedback
+Status: Open
Type: Bug
Package: Mail related
-Operating System:
+Operating System: x86_64-redhat-linux-gnu
PHP Version: 7.1.0
Block user comment: N
Private report: N
New Comment:
Much appreciated all for the replies.
@requinix: Thanks for the info. That helps narrow things down at least.
@cmb: Although i am using a shared hoster i am not able to modify the sendmail_path via php code.
So no go for the "echo". For the record the sendmail_path is set (for both local+master)
as: /usr/sbin/sendmail -t -i
@yohgaki: The mail.force_extra_parameters is set to "no value" for local and master.
Everything works fine for PHP7.0 but as soon as i switch to PHP7.1 its as if the "-f" is
being ignored when using the mail() function. Very strange. The OS (on this shared hoster) is:
x86_64-redhat-linux-gnu (Linux 2.6.32-673.26.1.lve1.4.20.el6.x86_64). As for the sendmail
variant... if it helps, when i type "sendmail --version" at the prompt i get back:
"Exim version 4.87 #1 built 21-Dec-2016 15:44:28"
I've opened up a ticket with the hoster and hopefully they can narrow things down. No reply in
2 days though (they are usually very fast on other tickets so this long delay might be an indication
they dont know or are still sniffing around).
Yea i figure its not an issue with PHP but instead is a configuration issue with the server when
using PHP7.1. However, i hope its ok to still leave this ticket open in hopes that you and others
can continue to comment here so it can give me new ideas to try or pass on to the hoster. If
it's not ok then let me know and i will happily close this ticket.
Thanks again all.
Previous Comments:
------------------------------------------------------------------------
[2017-01-15 16:50:45] yohgaki@php.net
Oops, I forgot mail.force_extra_parameters is INI_SYSTEM|INI_PERDIR. I'm not sure whether first
or last one is outstanding. Comment it out all of them if any, then it should work.
If not, check your UMA (sendmail command) manual how -f option works. There are sendmail command
variants. Your UMA may not support -f.
BTW, what is your OS?
------------------------------------------------------------------------
[2017-01-15 16:40:52] yohgaki@php.net
I guess you have
mail.force_extra_parameters = 'something'
or something like this in your INI. Comment the ini setting out like
;mail.force_extra_parameters =
to disable this INI.
If you don't have access to INI settings, e.g. php_admin_value, check the INI setting value by
phpinfo() or ini_get_all().
------------------------------------------------------------------------
[2017-01-14 18:16:50] cmb@php.net
Also consider to use something like sendmail_path=echo for
debugging.
------------------------------------------------------------------------
[2017-01-14 15:44:48] requinix@php.net
There have not been any changes to mail() in PHP 7.1 so far. Are you sure that your MTA is honoring
the -f parameter? What if you try using sendmail and -f from the command line?
------------------------------------------------------------------------
[2017-01-14 12:44:08] core905 at gmail dot com
Description:
------------
I notice in PHP 7.0 when using mail() it is able to set the envelope-from (i believe this is also
known as: Return-Path?) when i make use of the $additional_parameters field using "-f".
But in PHP7.1 this no longer works.
Test script:
---------------
$to = "to@email.com";
$from = "from@email.com";
$subject = "my subject";
$message = "my body";
$headers = "From: $from" . "\r\n" . "Reply-To: $from" .
"\r\n" . "Return-Path: $from" . "\r\n" . "X-Mailer: PHP/" .
phpversion();
$params = "-f$from";
mail($to, $subject, $message, $headers, $params);
Expected result:
----------------
the envelope-from (and return-path) doesnt match the "From" field in php7.1. It shows the
servers own outgoing address not the one i gave for the from field.
But when using the same test script in php7.0 it does match the from field and everything is
correct.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73934&edit=1
Thread (9 messages)