Sendmail

Configure Sendmail with Sendgrid for SmartHost Mail Relay

Technologies: 

Set the authorization credentials in /etc/mail/access

AuthInfo:smtp.sendgrid.net "U:apikey" "P:<yourAPIKey>" "M:PLAIN"

Define the Smart Host in /etc/mail/sendmail.mc.
You should add these lines just after the commented \#dnl define('SMART_HOST', 'smtp.your.provider')dnlĀ  line in the file. In Ubuntu these would be the last lines added to the file.