Msg#: 4639310 posted 5:01 pm on Jan 22, 2014 (gmt 0)
You have a MAIL FROM in the enveloppe of the email and you have a From: in the header. They are unrelated and not linked.
The enveloppe is used by mail transfer agents (MTAs - such as sendmail) to communicate with other MTAs. The enveloppe is removed before it's delivered in a mailbox of a user.
Why are they different: not so much for the From, but for the To, and Cc: and even more importantly: the bcc: not all copies stay together (say you send a mail to a gmail and to a hotmail user: it'll get spilt up to go to MSFT and a copy to go to Google. But those servers can't use the header as that's still to specify all targets, yet they only need to cover their part.
With your code you're only specifying the code in the header of the email, not touching the one in the enveloppe (which will default typically to the unixuser@machinename,example.com that's normal and expected.
mail($to,$subject,$message,$headers,'-f email@example.com'); should do the trick. Ref: [php.net...]
caveat: your sendmail needs to be configured to accept the -f option from the user that runs the php script (if running from the webserver that's the web server) Typically that's configured in /etc/mail/trusted-users nowadays.