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 The mail server could not deliver mail to root

Discussion in 'E-mail Discussions' started by philsward, Aug 29, 2017.

  1. philsward

    philsward Member

    Joined:
    Jan 3, 2017
    Messages:
    10
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    USA
    cPanel Access Level:
    Website Owner
    Looking at the WHM Mail Delivery Reports, I was met with the following error:

    The mail server could not deliver mail to root@server.hostname.com. The account or domain may not exist, they may be blacklisted, or missing the proper dns entries.

    I researched the issue and despite having an email address setup in Server Contacts -> Edit System Mail Preferences which is the typical suggestion, I was still receiving the error. I finally ran across a blog that pointed to a fix for this situation that did indeed work. I'm posting this to hopefully get some SEO going to help others.

    1) First thing to check are the settings in:

    Server Contacts -> Edit System Mail Preferences

    Make sure the setting: The system currently forwards mail for “root” is set to a valid email address.

    The other two sections, Forward mail for “cpanel” to: and Forward mail for “nobody” to: can either be set to "root" or a valid email address. If you're the only person maintaining the server, it would make the most sense to just point it to root. (It's perfectly fine to enter an email address too if you want)


    2) Second thing to check if you're getting the "The mail server could not deliver mail to root" error, is to look in:

    /etc/localdomains

    Look specifically for your servers host name. If it doesn't exist, add it.

    In my case, my hosting company was bought out by another company and the cPanel instance was transferred to the new companies servers. When I checked /etc/localdomains, the very first host name was the OLD hostname for the old hosting provider. Once I removed the old line and updated this with the new host name, the emails sent to root@server.hostname.com began working properly.

    ---

    While researching this issue, others who had a similar error had issues with their DNS and MX entries. If this post doesn't help, chances are it could be related to your DNS, rDNS, MX records or all of the above.
     
    cPanelMichael and Infopro like this.
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,127
    Likes Received:
    1,366
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hi @philsward,

    Thank you for taking the time to create this post to help those facing the same issue.

    We generally see this issue when the hostname is manually changed on the server from the command line with the "hostname" command. An entry for the hostname is automatically added to the /etc/localdomains file during the initial setup phase of the cPanel installation, and any time the hostname is changed through the "WHM >> Change Hostname" feature.

    Thanks!
     
Loading...

Share This Page