Connecting Tech Pros Worldwide Help | Site Map

mail not working

  #1  
Old October 17th, 2006, 11:05 AM
Alexander
Guest
 
Posts: n/a
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
  #2  
Old October 17th, 2006, 06:25 PM
Daz
Guest
 
Posts: n/a

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.

  #3  
Old October 18th, 2006, 12:15 AM
Geoff Muldoon
Guest
 
Posts: n/a

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

  #4  
Old October 18th, 2006, 06:55 AM
Alexander
Guest
 
Posts: n/a

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
  #5  
Old October 18th, 2006, 07:05 AM
Alexander
Guest
 
Posts: n/a

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
ISO 8859-1 Charset in PHP Mail Not Working. chunk1978 answers 1 August 22nd, 2007 05:13 AM
Mail not working nobrow@gmail.com answers 9 June 15th, 2007 09:45 PM
send mail not working nicholas answers 1 November 19th, 2005 10:09 AM
mail() not working to Y but works to Gmail joealey2003@yahoo.com answers 9 July 17th, 2005 02:30 PM