PHP mail()

I am using PHP to generate emails to be sent to members of a club for which I do admin work.

Everything seems to work fine, except that the emails being generated by the mail() call have a Return-path of rather than, and while I get a copy of the email I send out - so know it’s actually going out and it’s even properly formatted - some of my recipients are not getting the email.

Those same recipients get regular emails (return-path of ) so their emails are valid.

Is there a way to override Return-path in a mail() call so that I can get the generated emails to their destination?

Nothing in the wiki, nothing I can find on the web. There’s got to be a way to do this, right?



  1. create an email account via the panel… i.e.
  2. in the “mail” section of the panel click “message filters”
  3. click the “edit” button for
  4. click the “add new filter” button
  5. add a filter to forward mail “To” contains "" and select the destination "Forward to shell account ____"
    and select the correct shell user domain and shell use name.

This is a filter for incoming mail - I need to treat outgoing mail to change the return-path to my own address, not, which apparently triggers spam filters or something else undesirable.


Sorry about that, I read the wrong thing into your message, I thought you were trying to get returned mail back to the server for processing by a script.

[quote=“johngriswold, post:1, topic:60328”]
Nothing in the wiki, nothing I can find on the web. There’s got to be a way to do this, right?[/quote]

Actually there is stuff on the web about this issue as it is frequently asked.

Google Search

Not to mention the documentation for mail() specifies how to set the envelope sender.

Aha! Apparently the magic was to use Google instead of Bing for the search. Thanks.

Changing the header as suggested in the PHP mail() docs didn’t do the trick, but adding the "" as the fifth argument to the mail() call did the trick.

Thank you, kind sir!

(It remains to be seen if this allows the email to get to its destination)