Skip to main content

mail.add_x_header not logging

Comments

9 comments

  • cPanelLauren
    Hi @ksechrist is the actual header visible in the email or is it just the log file that isn't getting created? Have you read the PHP documentation on this as well? PHP: Runtime Configuration - Manual
    0
  • ksechrist
    it's writing the headers, it's just not logging. The headers don't help though if I don't receive the spam!
    0
  • cPanelLauren
    it's writing the headers, it's just not logging. The headers don't help though if I don't receive the spam!

    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.
    0
  • ksechrist
    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.
    0
  • cPanelLauren
    Which php.ini file are you inserting this into, the local or the php version's global?
    0
  • ksechrist
    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! :)
    0
  • cPanelLauren
    I got it to work on my test server here's what I did: 1. added the following: 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: 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: [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
    0
  • ksechrist
    :( 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)
    0
  • cPanelLauren
    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.
    0

Please sign in to leave a comment.