Skip to main content

Configure Sendmail with Sendgrid for SmartHost Mail Relay

Submitted by system on
Set the authorization credentials in /etc/mail/access AuthInfo:smtp.sendgrid.net "U:apikey" "P:" "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. define(`SMART_HOST', `smtp.sendgrid.net')dnl
FEATURE(`access_db')dnl
define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
define(`ESMTP_MAILER_ARGS', `TCP $h 587')dnl

Update sendmail.cf and access.db files Run these commands as root: $ cd /etc/mail
$ m4 sendmail.mc >sendmail.cf
$ makemap hash access.db < access

Restart Send Mail $ service sendmail restart
-- https://docs.sendgrid.com/for-developers/sending-email/sendmail

Technologies