If you want SendGrid to be used for all of your local email without it skipping the relay for local domains (e.g. the servers domain), refer to the following steps.

After following this article on setting up send mail, add the following to /etc/mail/sendmail.mc

After the SMART_HOST entry add:


After the access\_db entry add:


Restart sendmail:

sudo /etc/init.d/sendmail restart