I had this issue of sendmail delivering mails meant for the domain locally instead of reading the mx records, but couldn't resolve it. Maybe someone could tell me if I am missing any step.
I have a vps running mydomain.com and my drupal site uses sendmail to send out mails on form submissions etc. However mails were reaching other domains but not the mails id of the mydomain.com hosted on the VPS. That was because sendmail was configured to route mails locally for this domain as evidenced by the log entries.
Jun 18 06:38:09 i-8941-41970-VM sendmail: r5HAqCB4013371: to=<email@example.com>, ctladdr=<apache@i-8941-41970-VM.cs22edcloud.internal$
I followed one of the posts on ServerFault and edited my /etc/mail/sendmail.mc
VERSIONID(`nullclient setup')dnl FEATURE(`nullclient',`mx.mydomain.com')dnl
I then ran m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
However mail not delivered to mydomain.com. the following entries are logged in /var/log/mailog
Jun 18 07:42:21 i-8941-41970-VM sendmail: r5I6gCQq026263: to=<firstname.lastname@example.org>, ctladdr=<apache@i-8941-41970-VM.cs22edcloud.internal> (48/48), delay=00:00:09, xdelay=00:00:09, mailer=esmtp, pri=121044, relay=mx1.mydomain.com. [188.8.131.52], dsn=4.0.0, stat=Deferred: 450 4.1.8 <apache@i-8941-41970-VM.cs22edcloud.internal>: Sender address rejected: Domain not found