Difference between revisions of "Configure Sendmail Relays - CentOS 7"
Jump to navigation
Jump to search
Michael.mast (talk | contribs) |
Michael.mast (talk | contribs) |
||
Line 8: | Line 8: | ||
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. | 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== | ==SMTP Authentication== | ||
− | For when you want to send emails using an external SMTP server that requires authentication.<ref>https://unix.stackexchange.com/questions/204299/centos-sendmail-smtp-smarthost-with-authentication</ref> | + | For when you want to send emails using an external SMTP server that requires authentication.<ref>https://unix.stackexchange.com/questions/204299/centos-sendmail-smtp-smarthost-with-authentication</ref><ref>https://access.redhat.com/solutions/60803</ref> |
<pre> | <pre> | ||
yum install sendmail sendmail-cf | 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/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')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 | ||
+ | systemctl restart sendmail | ||
+ | |||
</pre> | </pre> |
Revision as of 12:04, 4 May 2018
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]
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')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 systemctl restart sendmail