I am using PHP with Apache on Linux, with sendmail. I use the PHP mail() function. The email is sent, but the envelope has the Apache_user@localhostname in MAIL FROM (example [email protected]) and some remote mailservers reject this because the domain doesn't exist (obviously). Using PHP mail(), can I force change the envelope MAIL FROM?
EDIT: If I add a Header in the fourth field of the mail() function, that changes the From field in the headers of the body of the message, and DOES NOT change the envelope MAIL FROM.
I can force it by spawning sendmail with "sendmail -t -odb -oi -frealname@realhost" and piping the email contents to it. Is this a better approach?
Is there a better, simpler, more PHP appropriate way of doing this?
EDIT: The bottom line is I should have RTFM. Thanks for the answers folks, the fifth parameter works and all is well.