php mail() -f additional_parameters does nothing

Oct 8, 2003
21
2
153
I've spent the last couple of hours google'ing and trying all sorts of test to
try and set up a bounce address hander for the php mail function.
No mater what i try the -f 5th mail() parameter does nothing.

Using this:

PHP:
<?php
	$mail_to = "[email protected]";
	$mail_subject = "Subject";
	$mail_message = "Message";
	$mail_headers = 'From: [email protected]' . "\r\n";

	mail($mail_to, $mail_subject, $mail_message, $mail_headers, "[email protected]");
?>
Even setting:

/etc/mail/trusted-users

to:
apache, nobody, mywwwusr
and without (empty as default)

No matter what I try, the return header in the e-mail always bounces back
to the "From", not the -f bounce user, on good e-mails has the "From", not -f

I've looked through the Exim consider, nothing stands out, i even changed
the -f option there.. (affects outlook comment) nothing... and changed it back.

my php.ini is set to default path:

sendmail_path = "/usr/sbin/sendmail -t -i"


I've got my own server, so it's not an webhoster issue.

I'd like to know how i can tell all mails i send from mail() where to bounce back.

I even tried setting the "Errors-To" (which isn't recommended in the RFC), it's set in the headers,
does nothing... everything still comes back to the "From" sender.

Any pointers on what is preventing this would be great.
 

Imai

Well-Known Member
Aug 11, 2003
45
0
156
Hello Neil

Did you solve this problem?
please share

Thank You
Imai
 

devendradb

Member
May 8, 2010
18
0
51
Mumbai, India
On shared webhosting and cpanel they disabled PHP mail() internal function. so you need to install Pear Mail Package on Cpanel. On your website Cpanel search PHP Pear modules click on it. It will first show you previously instaaled Pear packages then click on available Pear packages. Select Mail Package latest version and say install. for using pear mail sendmail function see online documentation. if you could not find solution let me know
- Devendra
 

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,216
12
313
Houston, TX
cPanel Access Level
Root Administrator
On shared webhosting and cpanel they disabled PHP mail() internal function. so you need to install Pear Mail Package on Cpanel. On your website Cpanel search PHP Pear modules click on it. It will first show you previously instaaled Pear packages then click on available Pear packages. Select Mail Package latest version and say install. for using pear mail sendmail function see online documentation. if you could not find solution let me know
- Devendra
Note: cPanel&WHM does not disable the PHP mail() function by default. However, this is something a system administrator can configure via WHM.