[BlueOnyx:07847] Re: php mail function issue

Michael Stauber mstauber at blueonyx.it
Mon Jul 25 16:52:21 -05 2011


Hi Chris,

> The problem really 
> appears to surround the issue of what the sender of the email is.  It 
> looks to me like "apache" is sending the email, but of course there's no 
> apache user and you cannot create an apache alias.

That issue has been around as long as the mail() function has been around:

You must manually set a (valid!) sender address and pass that info to the mail 
function. If you don't, then PHP simply assumes "apache at localhost", which of 
course won't get you anywhere, as Sendmail will reject that sender.

The "wrong" solution there is to force Apache to use a new default with a 
working address, which can be done in php.ini. The right solution is to use 
the mail() function in a way that specifies a working address as sender of the 
email.

A yet better method is to not use mail() and to instead use something that has 
a lot less limitations and allows for more options that actually work.

See [BlueOnyx:07835], where I posted some examples.

-- 
With best regards

Michael Stauber



More information about the Blueonyx mailing list