Connecting Tech Pros Worldwide Help | Site Map

mail not working

 
LinkBack Thread Tools Search this Thread
  #1  
Old October 17th, 2006, 10:05 AM
Alexander
Guest
 
Posts: n/a
Default mail not working

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, 05:25 PM
Daz
Guest
 
Posts: n/a
Default 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 17th, 2006, 11:15 PM
Geoff Muldoon
Guest
 
Posts: n/a
Default 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, 05:55 AM
Alexander
Guest
 
Posts: n/a
Default 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, 06:05 AM
Alexander
Guest
 
Posts: n/a
Default 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
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.