SOLVED The mail server could not deliver mail to root

philsward

Active Member
Jan 3, 2017
26
12
3
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 [email protected]. 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 [email protected] 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

Administrator
Staff member
Apr 11, 2011
47,883
2,256
463
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!