mail not working

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

for some reason it seems PHP is not properly passing the sender's  
address to sendmail. It does not matter whether I add "From" as header,  
"nobody@new" is always taken as originating addres (be it return-path,  
from or sender).

sendmail logs the following line

Is this due to a wrong sendmail configuration or would I need to change  
something within PHP?


Re: mail not working

Alexander wrote:
Quoted text here. Click to load it

Hi Alexander,

Just a thought, but have you had a look at what comes after the 'MAIL
FROM' argument. I think this might be where you error lies.


Re: mail not working

Daz wrote:
Quoted text here. Click to load it

Thanks Daz, I was aware that the problem was the wrong return path, but  
I wondered why it was set that way and where the new as hostname came from.

I solved it meanwhile by overriding the default sendmail_path value with  
a properly added "-f" parameter (php_value did not work for some reason,  
I had to use php_admin_value) and adding the Apache users to the trusted  
mail users.

If you want to see it, the site is at
- I know, shameless plug ;)

Thanks again,

Re: mail not working

postmaster@ says...

Quoted text here. Click to load it


$to = "";
$subject = "this is a test";
$body = "test 123";
$headers = "From:";
$params = "-f";

mail($to, $subject, $body, $headers, $params);

Notice the fifth parameter with the -f setting.  This is used in many  
sendmail installations to set a "canonical" from address, setting it  
purely in the headers is often ignored as it can be used as a common  
spam/spoof exploit.


Re: mail not working

Geoff Muldoon wrote:
Quoted text here. Click to load it

Thank you Geoff!

As I already wrote in my reply to Daz I solved it meanwhile by doing  
exactly this - more or less :). In order not having to edit any script  
with a mail() call I overrode the host's wide value and it seems to be  
working now.

Thanks again Geoff,

Site Timeline