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.

Using X-Script-PHP for non-nobody mail senders

Discussion in 'E-mail Discussions' started by Silent Ninja, Jul 4, 2013.

  1. Silent Ninja

    Silent Ninja Well-Known Member

    Joined:
    Apr 18, 2006
    Messages:
    198
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Buenos Aires, Argentina
    I have a customer that uses a mail form in PHP to send e-mails as a different e-mail account (from address changed).

    He used the header "Sender" with his own domain to show "in behalf of <domain>", but my cPanel server seems to be removing that line from the headers, and writing my hostname instead of his own domain.

    On the linen X-PHP-Script and X-Source-Dir the domain is shown correctly, but it seems that GMail and Outlook reads the line saying X-Get-Message-Sender-Via or X-AntiAbuse: Sender Address Domain (not sure which one) which shows my hostname.

    Is there some tweak to make my cPanel server show the originating domain from X-PHP-Script instead of my hostname?
     
    #1 Silent Ninja, Jul 4, 2013
    Last edited: Jul 4, 2013
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

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

    You can try enabling the following option under the "Mail" tab in "WHM Home » Service Configuration » Exim Configuration Manager":

    "Set SMTP Sender: headers"

    Per it's description:

    (-f flag passed to sendmail) This will create “On behalf of” notices in Microsoft® Outlook, but it may also help track abuse of the mail system since recipients will see the SMTP login used to send each message.

    Keep in mind that you may need to also configure the script to utilize SMTP Authentication for sending email.

    Thank you.
     
  3. Silent Ninja

    Silent Ninja Well-Known Member

    Joined:
    Apr 18, 2006
    Messages:
    198
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Buenos Aires, Argentina
    Hmm, I'm not sure if that's want I'm looking for. It seems that option adds the Sender automatically, and I won't use SMTP Auth in this case it would be unpractical.

    I want to be able to EDIT the Sender variable using the mail function headers, or using the fifth parameter. Here's the function I want to use:

    mail('somebody@gmail.com', 'testing', 'content', "From: somebody@example.com\r\nSender:webmaster@<mydomain>\r\n", '-fwebmaster@<mydomain>');

    cPanel seems to be removing the Sender header and the fifth parameter as well; thus the email is marked as spam because I'm obviously not the owner of example.com.

    I want to be able to set the Sender header in this server, since it's a dedicated server, and have it shown "in behalf of <mydomain>" instead of <myhostname>
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    654
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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. Most applications that call the Exim/Sendmail binary will pass the -f switch along with the proper email address to keep that from happening. 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". Keep in mind that your results may vary depending on which mail server is accepting the email.

    Thank you.
     
Loading...

Share This Page