Connecting Tech Pros Worldwide Forums | Help | Site Map

mail not working

Alexander
Guest
 
Posts: n/a
#1: Oct 17 '06
Hi,

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

SMTP error from remote mailer after MAIL FROM:<nobody@new>

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

Thanks,
Alexander

Daz
Guest
 
Posts: n/a
#2: Oct 17 '06

re: mail not working



Alexander wrote:
Quote:
Hi,
>
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
>
SMTP error from remote mailer after MAIL FROM:<nobody@new>
>
Is this due to a wrong sendmail configuration or would I need to change
something within PHP?
>
Thanks,
Alexander
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.

Daz.

Geoff Muldoon
Guest
 
Posts: n/a
#3: Oct 18 '06

re: mail not working


postmaster@127.0.0.1 says...
Quote:
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
>
SMTP error from remote mailer after MAIL FROM:<nobody@new>
>
Is this due to a wrong sendmail configuration or would I need to change
something within PHP?
Try:

$to = "me@testaddress.com";
$subject = "this is a test";
$body = "test 123";
$headers = "From: me@sendaddress.com";
$params = "-f me@sendaddress.com";

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.

Geoff

Alexander
Guest
 
Posts: n/a
#4: Oct 18 '06

re: mail not working


Daz wrote:
Quote:
>
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.
>
Daz.
>
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 http://www.citypics.org/index.php
- I know, shameless plug ;)

Thanks again,
Alexander
Alexander
Guest
 
Posts: n/a
#5: Oct 18 '06

re: mail not working


Geoff Muldoon wrote:
Quote:
>
Try:
>
$to = "me@testaddress.com";
$subject = "this is a test";
$body = "test 123";
$headers = "From: me@sendaddress.com";
$params = "-f me@sendaddress.com";
>
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.
>
Geoff
>
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,
Alexander
Closed Thread