Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Reply-to: header in PHP mail scripts

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

  1. shacker23

    shacker23 Well-Known Member

    Joined:
    Feb 20, 2005
    Messages:
    263
    Likes Received:
    1
    Trophy Points:
    168
    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:
    358
    Likes Received:
    1
    Trophy Points:
    168
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,563
    Likes Received:
    42
    Trophy Points:
    308
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. shacker23

    shacker23 Well-Known Member

    Joined:
    Feb 20, 2005
    Messages:
    263
    Likes Received:
    1
    Trophy Points:
    168
    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,563
    Likes Received:
    42
    Trophy Points:
    308
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. shacker23

    shacker23 Well-Known Member

    Joined:
    Feb 20, 2005
    Messages:
    263
    Likes Received:
    1
    Trophy Points:
    168
    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

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice