I'm a big -1 on this.  The patch will not actually solve the root problem.

On Unix systems, the MTA needs to know that the webserver user is
'trusted' to masquerade as another user.  In exim this would be the
'trusted-users' directive, sendmail, qmail, and postfix have similar
directives.

On Windows systems it is necessary to use ini_set() to change the value of
"sendmail_from", though this won't necessarily work with all MTAs.

It doesn't help that the behavior of mail() varies so greatly between
platforms.

I agree that the documentation could use some updating in this regard and
would be happy to make that modification after I collect up some examples
of the correct directives to use on common systems.

-Pollita

> I was fed up with getting a lot of bounce mails of users on my host, who
> apparently just have discovered the mail() function in PHP and are
> writing mails to bogus recipients.
>
> Apparently, the default "Return-Path" that is being set by our MTA
> (qmail) is "Return-Path: <anonymous@myhost>", even if the user has set a
> "From:" header. I thought this was quite counter-intuitive, as any error
> messages, such as not available mailboxes etc.. were bouncing back to me
> instead of the users.
>
> Instead of documenting this behaviour and telling all users that they
> should also add a "Return-Path" to their mail() commands, I decided to
> write a patch which, if no Return-Path header was set, would use the
>>From header instead (if it existed, of course).
>
> I'm pretty sure this is not the right thing (tm) to do, as I should
> rather fix this problem with my MTA. However, I am currently too dumb to
> understand qmail's sources (DJB should have really commented his
> sourcecode), therefore I just did this quick fix. I posted it here
> because I heard others having the same problem. All others please
> just ignore this posting :)
>
> Warning(s):
>   - This is NOT a general-purpose patch (do not apply to main branch) -
> This patch probably breaks all rules on coding style and consistency
>     (malloc instead of emalloc etc..)
>   - I know C for only a couple of weeks. Don't blame me if everything
>     crashes and your machine burns down.
>
> -daniel




-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to