Configure Sendmail Relays - CentOS 7

From Michael's Information Zone
Revision as of 12:55, 4 May 2018 by Michael.mast (talk | contribs) (→‎Amazon SES)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Purpose

To configure sendmail to send email.

Basic Relay Config

This will change the server you send emails through, instead of looking up MX records and sending directly to the recipient. Such as Amazon SES
[1] Looking in the /etc/mail/sendmail.mc file add a smarthost entry that looks like the following

define(`SMART_HOST', `insidemail.tld')dnl

I had to use a fqdn and a host entry to resolve it with. There is a way to use an IP but I have not spent enough time working on this. Just needed it to send mail internally for now.

SMTP Authentication

For when you want to send emails using an external SMTP server that requires authentication.[2][3]

Amazon SES

[4][5]

yum install sendmail sendmail-cf
sed -i 's/smtp\.your\.provider/email-smtp\.us-east-1\.amazonaws\.com/; s/^dnl\ define(`SMART/define(`SMART/' /etc/mail/sendmail.mc
sed -i 's/dnl\ define(`confAUTH_MECHANISMS/define(`confAUTH_MECHANISMS/' /etc/mail/sendmail.mc
echo "FEATURE(\`authinfo',\`hash /etc/mail/authinfo.db')dnl" >> /etc/mail/sendmail.mc
echo "AuthInfo:email-smtp.us-east-1.amazonaws.com    \"U:username\" \"P:password\" \"M:PLAIN\"" >> /etc/mail/authinfo
makemap hash /etc/mail/authinfo < /etc/mail/authinfo
echo "Connect:email-smtp.us-east-1.amazonaws.com RELAY" >> /etc/mail/access
makemap hash /etc/mail/access.db < /etc/mail/access

systemctl restart sendmail