I have a Ubuntu server, running sendmail (until this morning it was running postfix, but I moved to sendmail to eliminate the possibility of my postfix configuration tweaks being the cause of this issue). Up until a few weeks ago, this server was the sole mail server for my domain - and until I moved mail away from this box, email worked as expected, was delivered to the local users and was sent fine - but since moving it away, every time an email is sent through the MTA on this box it attempts to send it to the A record for my domain, rather than the MX records...which doesn't work very well as I use a CDN, and the CDN aren't hosting my mail funnily enough. From everywhere else to my domain is fine, and from that server sending to other domains is fine. If you perform a dig or an nslookup from the problem server the records appear correct, so after battling with this for nearly a week I'm stumped. Any help would be appreciated!
EDIT: DNS records for domain;
domain.com CNAME to server.domain.com
server.domain.com A to 22.214.171.124
MX mail.maildomain.com priority 10
MX mail1.maildomain.com priority 20
the server with issues is server.domain.com.