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:

define(MAIL_HUB',smtp.sendgrid.net’)

After the access\_db entry add:

FEATURE(`stickyhost')

Restart sendmail:

sudo /etc/init.d/sendmail restart