Skip to contentSkip to navigationSkip to topbar
Rate this page:

Sendmail


If you're looking to enhance your email delivery capabilities with SendGrid and Sendmail, you're in the right place. Setting up Sendmail to work seamlessly with SendGrid's SMTP service can greatly improve the reliability and efficiency of your email communications.

(error)

Danger

Sendmail requires libsasl in order to properly send authentication requests to SendGrid servers. The saslauthd server daemon is not required unless you plan to receive authentication requests to the same server. For more information on configuring sendmail for SASL support, check the official documentation(link takes you to an external page).

Set the authorization credentials in /etc/mail/access

(error)

Danger

We have had reports that some customers have needed to install cyrus-sasl-plain in order to avoid authentication issues as well. We have not validated this requirement, so please make sure your system administrators, Ops, and/or InfoSec people approve this change before you make it!


_10
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


_10
define(`SMART_HOST', `smtp.sendgrid.net')dnl
_10
FEATURE(`access_db')dnl
_10
define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
_10
define(`ESMTP_MAILER_ARGS', `TCP $h 587')dnl

Update sendmail.cf and access.db files

(You will need to run these commands as 'su' or 'root')


_10
cd /etc/mail
_10
m4 sendmail.mc >sendmail.cf
_10
makemap hash access.db < access

On older distros, you can run restart sendmail like so:


_10
/etc/init.d/sendmail restart

If, however, you're using a newer version, do the following to restart:


_10
service sendmail restart

Now, your Sendmail configuration is optimized for using SendGrid's SMTP service, ensuring efficient and reliable email delivery.


Rate this page: