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.

Emails from PHP scripts have server's domain instead of clients.

Discussion in 'E-mail Discussions' started by cerberusgr, Sep 25, 2013.

  1. cerberusgr

    cerberusgr Registered

    Joined:
    Sep 25, 2013
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hello,

    Im trying some time now to resolve this issue, i have it since i setup the server, all emails sent by scripts that doesnt explicitly sets sender address given the username@serverhostname format, i want these email to be sent as from username@userdomain.

    Can you point me to the right and safe solution to do this?

    Thanks in advance
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    648
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    The default behavior when sending email through PHP is to use the cPanel username and hostname of the server to construct the envelope-sender address. If you can configure the mailer to use SMTP and authenticate with SMTP AUTH, this will set the correct "Return-Path" in the headers. The other option is to make sure that the application is using the 5th argument to the PHP mail() function to send the '-f' switch to sendmail so that it sets the correct "Return-Path".

    Thank you.
     
  3. andryan

    andryan Member

    Joined:
    Apr 23, 2005
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    Michael, can you please show us how to configure that (disallow non-SMTP auth relay or even block emails from cpanelusername@serverhostname) in Exim?
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    648
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    There are no options you can enable to force the use of SMTP authentication because the method used to send email is determined by how the script is coded. You will have to manually modify your PHP scripts to ensure they use SMTP authentication. If you want to block your PHP scripts from sending out email, you could ensure the mail function is disabled in your php.ini configuraton.

    Thank you.
     
Loading...

Share This Page