550 Relay Error in Exim
By Erik Rodriguez
This article provides information on errors you may experience using exim and CPanel.
Why use Exim?
I like exim. It's a fairly small package and runs well for both small and large size deployments. I've been using exim for a few years now and it's my favorite Linux mail daemon, and I like it much more than sendmail... At OTW, we use exim for POP3 and IMAP hosting if our customers don't want to pay for Exchange hosting. As much as I don't like M$, I do love exchange. Sure there are some open source alternatives, but nothing meshes as well with everything else like exchange does.
Okay, It's Already Broken
If you do enough work with e-mail, you'll relize that most of your errors boil down to DNS. A "550: relaying not permitted", might lead me to beleive there is some kind of DNS error. However, each *nix mail daemon has it's own little method of handling mail queries. Exim, sendmail, postfix, and qmail all have their own little quirks. So, if you are certain your DNS records are correct and you are using exim, check your /etc/localdomains file. Exim will try to deliver mail to any domains listed in that file if such domain resides on the same server. Exim will look to this file BEFORE sending an external DNS request. So, if you are hosting a domain [orlandotechworks.com] from the same server running exim, make sure it is listed in that file.
External Mail Servers...
The oppsite is also true. I have orlandotechworks.com hosted a Cpanel server. However, the mail is handled by exchange. Obviously if you are going to host your mail on different box, you will need to setup your DNS with the correct A record and MX pointer. Another step you need to perform is REMOVE that domain from the localdomains file on your server. If you don't, this will result in your mail being delivered to the local mailbox and not your external server. This is because the server will see the domain as a local domain, and NOT perform an external DNS request. The sender will not receive a non-deliverable message, and it will seem as if those messages will go to LA LA land...
How Does This Happen?
If you haven't changed any DNS entries it may be that some type of update or move function has removed or added domains to your /etc/localdomains file. If you are using CPanel, this is often a result of running the "Repair Mailbox permissions" tool in WHM. I don't know why they put that in there, and I don't see why you would ever need to use it. If you are moving accounts between CPanel servers, always check your /etc/localdomains and additional DNS records. I have moved accounts between servers and for whatever reason my additional manually entered A records disappeared. If you aren't running DNS servers on your CPanel boxes, that should be an issue.
3 - 2 -1
Overall, exim is a very good MTA. There are just a few things you need to watch out for. Like any Linux daemon, make sure you know all the key components like log location, executable files, and config files before you start running them. It's never a good idea to start running a service or daemon you don't know anything about. Especially in a production environment. You'd be surprised how often I have seen or heard this being done.