What I did to disable local delivery. I'll be using the example.com domain.
Requirements:
- example.com A entry pointing to IP address assigned to one of the eth interfaces.
- /etc/hosts defining example.com assigned to the very same IP address as above
- example.com MX records pointing to Google servers (ASPMX.L.GOOGLE.COM, etc)
- default sendmail installation (mine was on Ubuntu)
Steps are as follows :
#1. vim /etc/mail/sendmail.mc
#2. Add the below 2 lines at the end of the file
define('MAIL_HUB', 'example.com.')dnl
define('LOCAL_RELAY', 'example.com.')dnl
#3. Perform the below given things
$ sendmailconfig
(or /etc/mail/make depending on your distro)
$ service sendmail restart
Now, go ahead and test the mail now. You will see the problem getting resolved now.