Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Member cwalke32477's Avatar
    Join Date
    Mar 2010
    Location
    Atlanta, Georgia
    Posts
    94
    cPanel/Enkompass Access Level

    Root Administrator

    Default Php scripts send mail as user@servername.com

    How can I make php scripts send mail as user@account.com instead of user@servername.com?
    I would like to set this universally.
    I know each site admin can do it by editing the php code, but I know there is a way to have it as default serverwide, as I have had a server in the past that sent it as such.

    Any advice appreciated, thanks
    Chris Walker
    http://www.siterack.net
    Reseller Hosting - HostReady® VPS Servers - Dedicated Servers

  2. #2
    Member
    Join Date
    Sep 2004
    Location
    inside a catfish
    Posts
    963
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: Php scripts send mail as user@servername.com

    Quote Originally Posted by cwalke32477 View Post
    I know each site admin can do it by editing the php code, but I know there is a way to have it as default serverwide, as I have had a server in the past that sent it as such.
    Really? I don't believe that would ever be possible, unless each user had their own php.ini and it was specified in the php.ini. Otherwise, I believe the only option is for the client to do it within their own PHP code. Think about it -- how would the server ever know to send it out as "such_and_such@domain.com". PHP does not have access to anything that would tell it the such_and_such@domain.com for each and every domain.

    NOTE: You may be able to edit the core PHP.INI file and set one single address that is used as the default sender address.... if that's what you are asking.

    Mike

  3. #3
    Member cwalke32477's Avatar
    Join Date
    Mar 2010
    Location
    Atlanta, Georgia
    Posts
    94
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: Php scripts send mail as user@servername.com

    Unfortunately I have no idea how the last server was configured, as it was setup for me, and was a VPS server.
    This new one is a full dedicated that I had to setup and configure.
    But all the accounts on it were sending mail under user@userdomain
    Chris Walker
    http://www.siterack.net
    Reseller Hosting - HostReady® VPS Servers - Dedicated Servers

  4. #4
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Apr 2008
    Location
    PK
    Posts
    443

    Default Re: Php scripts send mail as user@servername.com

    You can resolve this by building proper headers in your scripts via mail() and ensure you use the fifth parameter given below.

    Code:
    mail($to, $message, $subject, "From: $from", "-f$from");
    You can check official PHP mail() function documentation by clicking at this link.

    Additionally you can check this link as a reference.

    Quote Originally Posted by cwalke32477 View Post
    How can I make php scripts send mail as user@account.com instead of user@servername.com?
    I would like to set this universally.
    I know each site admin can do it by editing the php code, but I know there is a way to have it as default serverwide, as I have had a server in the past that sent it as such.

    Any advice appreciated, thanks
    1 solution works for all problems. Trying harder!
    HostMasterTips - Understanding Tech Support

Similar Threads & Tags
Similar threads

  1. Mail is send to user@server.com and to user@domain.com
    By gleidsonlm in forum E-mail Discussions
    Replies: 1
    Last Post: 10-07-2007, 03:18 PM
  2. allow php scripts to send emails
    By ramil in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 11-10-2006, 11:30 AM
  3. Where is the routine that looks for scripts that send mail.
    By jols in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 12-07-2005, 07:40 AM
  4. Mail issue: getting empty reply back from user@servername
    By NNNils in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 11-24-2003, 08:49 AM
  5. Php scripts does not send e-mail (This is *URGENT*)
    By zex in forum cPanel and WHM Discussions
    Replies: 5
    Last Post: 12-30-2001, 07:49 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube