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!

mail.add_x_header not logging

Discussion in 'E-mail Discussion' started by ksechrist, May 12, 2019.

  1. ksechrist

    ksechrist Active Member

    Joined:
    Jan 27, 2019
    Messages:
    27
    Likes Received:
    5
    Trophy Points:
    3
    Location:
    Texas
    cPanel Access Level:
    Root Administrator
    My IPs are clean, but a bunch in my /16 block are listed on Barracuda's RBL and Charter is blocking me because of it. I'm staying on my host to get these cleaned up, but meanwhile I thought it would be good to monitor for issues on my server.

    So I added this to all my php.ini files for each php version, tried root owner and apache (nobody) owner, even tried setting permission to 777, yet the log remains blank.

    Tried this first:
    Code:
    mail.add_x_header = On
    mail.log = /var/log/phpmail.log
    When that didn't work, I found someone else having the same trouble but they got it working by using the tmp folder, so I tried :

    Code:
    mail.add_x_header = On
    mail.log = /var/tmp/phpmail.log
    I restarted Apache after changing the php.ini files - is there something else I need to do to get this working?
     
  2. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    6,141
    Likes Received:
    474
    Trophy Points:
    233
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. ksechrist

    ksechrist Active Member

    Joined:
    Jan 27, 2019
    Messages:
    27
    Likes Received:
    5
    Trophy Points:
    3
    Location:
    Texas
    cPanel Access Level:
    Root Administrator
    it's writing the headers, it's just not logging. The headers don't help though if I don't receive the spam!
     
  4. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    6,141
    Likes Received:
    474
    Trophy Points:
    233
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    My initial concern was whether or not any of it was working, or just the logging. It sounds like it's just the logging. If you create
    /var/log/phpmail.log as the user does it output to the log? This is more of a system administration task but I'm curious as well at this point. I may try this on a test system to see if I can get it to work as well.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. ksechrist

    ksechrist Active Member

    Joined:
    Jan 27, 2019
    Messages:
    27
    Likes Received:
    5
    Trophy Points:
    3
    Location:
    Texas
    cPanel Access Level:
    Root Administrator
    I tried changing the owner and group for the log to one of the account users - I hope this is essentially the same as creating the log as the user? It didn't work.
     
  6. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    6,141
    Likes Received:
    474
    Trophy Points:
    233
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Which php.ini file are you inserting this into, the local or the php version's global?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. ksechrist

    ksechrist Active Member

    Joined:
    Jan 27, 2019
    Messages:
    27
    Likes Received:
    5
    Trophy Points:
    3
    Location:
    Texas
    cPanel Access Level:
    Root Administrator
    I started with global... then tried local on one of the sites... when I tried local, I even tried changing group/owner to that site's user/group... I'm starting to think I've tried everything, but there must be something I'm missing! Thank you for trying to help! :)
     
  8. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    6,141
    Likes Received:
    474
    Trophy Points:
    233
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    I got it to work on my test server here's what I did:

    1. added the following:
    Code:
    mail.add_x_header = On
    mail.log = /var/tmp/phpmail.log
    to the global php.ini for php 7.1 - this must be done through WHM's MultiPHP INI Manager

    2. Created a test PHP mail script - for purposes of this testing I used 777 perms on it

    3. Ran the script over CLI with the following:

    Code:
    ea-php71 test-email.php
    To run it this way you need to run it from the directory where the script resides otherwise you'll need to call the full path

    4. Checked /var/tmp/phpmail.log and found:

    Code:
    [15-May-2019 21:00:43 UTC] mail() on [/home/myuser/public_html/test-email.php:9]: To: me@domain.com -- Headers: From:lauren@mydomain.com -- Subject: PHP Mail Test script
    [15-May-2019 21:09:12 UTC] mail() on [/home/myuser/public_html/test-email.php:9]: To: me@domain.com -- Headers: From:lauren@mydomain.com -- Subject: PHP Mail Test script
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. ksechrist

    ksechrist Active Member

    Joined:
    Jan 27, 2019
    Messages:
    27
    Likes Received:
    5
    Trophy Points:
    3
    Location:
    Texas
    cPanel Access Level:
    Root Administrator
    :( I'm still on EasyApache3 so no multiphp ini manager...

    I've known I needed to do this update, but the last time I did a major update (cpanel was 10 versions behind when I got this server) it broke all kinds of things. I also have an old application running php 5.3 - I'll have to find out if it will work on 5.4.

    Thank you for trying so hard Lauren... I really appreciate it. And now I got the kick I needed to move forward with upgrading my application and easyapache (or changing to another hosting company altogether)
     
  10. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    6,141
    Likes Received:
    474
    Trophy Points:
    233
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Hi @ksechrist

    I'm happy to help, I, unfortunately, can't try this on an EasyApache 3 system but the primary difference would be the global php.ini in /usr/local/lib/php.ini, I'd assume.

    I can't stress to you enough how important it is to keep cPanel and your php up to date. If your sites can handle newer versions of PHP and you want help migrating to EasyApache 4 please open a ticket with us and we'd be more than happy to assist with that.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
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