sendmail_path override

hansmiddelhoek

Verified User
Joined
Apr 26, 2005
Messages
40
Location
Netherlands
Hello,

I wrote a mail script, but when I use de additional section of the php mail() function for the from address, the e-mail can't be sent.
What's happening:
The httpd.conf for all domains get an:
Code:
php_admin_value sendmail_path '/usr/sbin/sendmail -t -i -f [email protected]'
The -f [email protected] takes care of the return path address in e-mails sent with php.

What I want is a different return path/from address, but when I specify the -f parameter in the mail() function an error occurs. The value of sendmail_path can't be overridden. I also tried .htaccess, but I couldn't get it to work either.

Does anybody know how I could workaround this problem, or just a simple solution? :)

Code:
bool mail ( string to, string subject, string message [, string additional_headers [, string additional_parameters]] )

additional_parameters (optional)

The additional_parameters parameter can be used to pass an additional parameter to the program configured to use when sending mail using the sendmail_path configuration setting.
For example, this can be used to set the envelope sender address when using sendmail with the -f sendmail option.

The user that the webserver runs as should be added as a trusted user to the sendmail configuration to prevent a 'X-Warning' header from being added to the message when the envelope sender (-f) is set using this method.
For sendmail users, this file is /etc/mail/trusted-users. 

mail('[email protected]', 'the subject', 'the message', null,
   '[email protected]');

Thanks in advance.
Kind regards,
Hans Middelhoek
 
Last edited:
That'll change the From address, but it won't change the return path.

Jeff
 
Yup and when I checked my headers in thunderbird my Return-Path became the email I input into the mail command and the From became what I put as well. Also the received line looked like
Code:
Received: from [*server ip*] (helo=*sending hostname*)	by *receiving hostname* with esmtps (TLSv1:AES256-SHA:256)	(Exim 4.66)	(envelope-from <*return-path email in php command*>)	id 1HCgXq-0008Ob-UW for *email i sent to*; Thu, 01 Feb 2007 13:20:26 -0500 (qmail 27706 invoked by uid 48); 1 Feb 2007 10:20:18 -0800
 
Old thread, but I was wondering what you finaly had for a solution.

A customer of mine has the same problem that he wants to change the senders address.
 
Bump...

Does anyone has experience in removing the -f from the httpd template ?

Is the use then able to choose there own from address ?
I advice them now to use a smtp class but in my opinion the php mail functie should work also.
 
Back
Top