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!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

SOLVED System Emails Are Still Sent To Root

Discussion in 'E-mail Discussions' started by linux4me2, May 1, 2017.

  1. linux4me2

    linux4me2 Well-Known Member

    Joined:
    Aug 21, 2015
    Messages:
    168
    Likes Received:
    36
    Trophy Points:
    28
    Location:
    USA
    cPanel Access Level:
    Root Administrator
    I am getting bounced, frozen emails in my mail queue when the system attempts to send email to root@host.mydomain.com (where host.mydomain.com is the hostname of my server). These emails appear to be from:
    • /var/cpanel/cwaf/scripts/updater.pl
    • /usr/local/cpanel/scripts/upcp
    • logwatch@host.mydomain.com
    Here is the output of commands to check the configuration:
    Code:
    root@host [4012 13:24:56 ~]# cat /etc/localaliases
    cpanel: validemail@gmail.com
    nobody: validemail@gmail.com
    root: validemail@gmail.com
    root@host [4013 13:25:26 ~]# cat /var/cpanel/userhomes/cpanel/.forward
    validemail@gmail.com
    root@host [4014 14:14:58 ~]# cat /root/.forward
    validemail@gmail.com
    root@host [4015 14:15:11 ~]# grep validemail@gmail.com /etc/valiases/*
    root@host [4016 14:15:45 ~]# grep validemail@gmail.com /etc/vfilters/*
    root@host [4017 14:16:11 ~]#
    
    Here is the output for the hosts file and reverse DNS:
    Code:
    root@host [4018 14:18:02 ~]# cat /etc/hosts
    127.0.0.1       localhost localhost.localdomain localhost4 localhost4.localdomain4
    ::1       localhost localhost.localdomain localhost6 localhost6.localdomain6
    192.168.122.229       centos6.template.mywebhost.com centos6 Bcast
    64.91.xxx.xxx       host.mydomain.com host
    root@host [4019 14:18:04 ~]# cat /etc/mail_reverse_dns
    96.30.xxx.xxx: host.mydomain.com
    
    Note that this server was migrated to a new VPS with all the previous IP addreses retained, so the primary IP of the new VPS (64.91.xxx.xxx) doesn't match the reverse DNS (96.30.xxx.xxx, the old primary IP), though all our email seems to be working fine so far.

    I've looked everywhere I can think of to find why root is still getting system emails. What else could it be?
     
  2. linux4me2

    linux4me2 Well-Known Member

    Joined:
    Aug 21, 2015
    Messages:
    168
    Likes Received:
    36
    Trophy Points:
    28
    Location:
    USA
    cPanel Access Level:
    Root Administrator
    I thought that WHM's settings would override what's in /etc/crontab, but I looked just to see what the MAILTO was set to, and it is set to "root":
    Code:
    MAILTO=root
    
     
  3. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    15,767
    Likes Received:
    313
    Trophy Points:
    433
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    You should get some sort of clue here:
    WebHost Manager »Email »Mail Delivery Reports

    It may be that gmail is rate limiting or blocking the emails.
     
  4. linux4me2

    linux4me2 Well-Known Member

    Joined:
    Aug 21, 2015
    Messages:
    168
    Likes Received:
    36
    Trophy Points:
    28
    Location:
    USA
    cPanel Access Level:
    Root Administrator
    The emails are never making it to Gmail. This is what I see when I look at the bounces in the Mail Queue:

    Code:
    This message was created automatically by mail delivery software.
    
    A message that you sent could not be delivered to one or more of its
    recipients. This is a permanent error. The following address(es) failed:
    
      root@host.mydomain.com
        The mail server could not deliver mail to root@host.mydomain.com.  The account or domain may not exist, they may be blacklisted, or missing the proper dns entries.
    ...
    
    The messages are sent from the Cron Daemon to root@host.mydomain.com instead of using the email addresses I have set, unless I need to set the MAILTO in /etc/crontab.
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,427
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    It's normal to see the notifications sent via email to root@hostname initially. The messages are then forwarded to the email address configured for "root" in "WHM >> Edit System Mail Preferences".

    Can you verify if the server's hostname is added to the /etc/localdomains file on this system? If not, add the server's hostname to this file and verify it doesn't exist in the /etc/remotedomains file. Then, check to see if the issue continues.

    Thank you.
     
    linux4me2 likes this.
  6. linux4me2

    linux4me2 Well-Known Member

    Joined:
    Aug 21, 2015
    Messages:
    168
    Likes Received:
    36
    Trophy Points:
    28
    Location:
    USA
    cPanel Access Level:
    Root Administrator
    So it's normal to have the frozen messages sent to root by the cron daemon in the Mail Queue, even with a valid email for root in WHM >> Edit System Mail Preferences as I do? It seems like I could prevent this by setting the MAILTO in crontab to an email address instead of "root"?

    The server's hostname is not in /etc/localdomains or in /etc/remotedomains. I have added it to /etc/localdomains, and I'll see what happens tonight when the crons run.
     
  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,427
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    It's not normal for the initial delivery attempt to fail, but it is normal for the system to make the initital delivery attempt to the root@hostname address. The email addresses configured in "Edit System Mail Preferences" are used to determine where the emails sent to root@hostname are forwarded, but don't actually change the use of root@hostname in locations such as cron jobs.

    This should address the issue you are facing. Let us know if you encounter any further problems.

    Thanks!
     
    linux4me2 likes this.
  8. linux4me2

    linux4me2 Well-Known Member

    Joined:
    Aug 21, 2015
    Messages:
    168
    Likes Received:
    36
    Trophy Points:
    28
    Location:
    USA
    cPanel Access Level:
    Root Administrator
    Thanks! I'll let you know tomorrow after the next round of cron jobs runs.
     
  9. linux4me2

    linux4me2 Well-Known Member

    Joined:
    Aug 21, 2015
    Messages:
    168
    Likes Received:
    36
    Trophy Points:
    28
    Location:
    USA
    cPanel Access Level:
    Root Administrator
    It looks like I won't have to wait until tomorrow to tell you that adding my hostname to /etc/localdomains has worked.

    I just got an email to the Gmail address set in WHM >> Edit System Mail Preferences that is addressed to root@hostname.

    I'm glad I'm getting the system emails now, but I think I opened a new can of worms. : ) The subject of the email is:
    Code:
    Cron <root@host> cd /usr/local/cpanel/whostmgr/docroot/cgi/fantastico/scripts/ ; /usr/local/cpanel/3rdparty/bin/php cron.php > /dev/null 2>&1
    
    and the body of the email is:
    Code:
    /bin/sh: line 0: cd: /usr/local/cpanel/whostmgr/docroot/cgi/fantastico/scripts/: No such file or directory
    
    It looks like I need to comment out the cron for the fantastico script.
     
  10. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,427
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    You'd need to remove that cron job if you no longer use that application, or reach out to their support team to determine the updated cron job to use.

    Thank you.
     
    linux4me2 likes this.
  11. linux4me2

    linux4me2 Well-Known Member

    Joined:
    Aug 21, 2015
    Messages:
    168
    Likes Received:
    36
    Trophy Points:
    28
    Location:
    USA
    cPanel Access Level:
    Root Administrator
    I don't use Fantastico, and as far as I can see, it's not even installed, so I just removed that cron job. Thanks for the help. I think it's safe to mark this one "solved".
     
    cPanelMichael likes this.
Loading...

Share This Page