The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Reply-to: header in PHP mail scripts

Discussion in 'E-mail Discussions' started by shacker23, Feb 7, 2007.

  1. shacker23

    shacker23 Well-Known Member

    Joined:
    Feb 20, 2005
    Messages:
    263
    Likes Received:
    1
    Trophy Points:
    16
    Does cPanel or exim do something to override the Reply-To header in PHP mail scripts? I have a user who uses a web-based form that sends responses to user submissions. Some of these messages fail to reach their destination, and they bounce back to nobody@myserver, rather than to user@domain, even though there's an explicit "Reply-To: user@domain" and "From: user@domain" in the headers.

    We tried setting "Return-Path: user@domain" in the headers, but this seems to be explicitly overridden or ignored - messages still go out with nobody@myserver in the headers.

    What's the best/right way to solve this?

    Thanks,
    Scot
     
  2. ckh

    ckh Well-Known Member

    Joined:
    Dec 6, 2003
    Messages:
    356
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Phoenix, AZ
    cPanel Access Level:
    DataCenter Provider
    You need to use the -f option to change the reply-to email address in the mail funciton. It should look something like:

    mail("$toEmail", $subject, $message, "FROM: $fromEmail","-f$replyToEmail");

    Chris
     
  3. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,458
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    The Reply-to header is set to the name of the owner of the calling process. For most PHP setups, the calling process is Apache, which often has the owner:group of nobody:nobdy. The -f option allows one to override this and "force" a specific address. Be warned though that the -f option can be disabled server-wide. In such scenarios, you are stuck with the Reply-to: nobody
     
  4. shacker23

    shacker23 Well-Known Member

    Joined:
    Feb 20, 2005
    Messages:
    263
    Likes Received:
    1
    Trophy Points:
    16
    Thanks for the tips guys - I'll try the -f flag. If it turns out it is being overridden, where can I disable that override? (I have root).

    Thanks,
    Scot
     
  5. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,458
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    If you are the only admin, then it's not set, in most cases, since it's not something cPanel does by default.
     
  6. shacker23

    shacker23 Well-Known Member

    Joined:
    Feb 20, 2005
    Messages:
    263
    Likes Received:
    1
    Trophy Points:
    16
    Testing... the -f flag sets the Return-Path rather than Reply-To, but that's what I was looking for to begin with. Many thanks.
     
Loading...

Share This Page