Monday, July 6, 2020

Postfix- Relay mails via office365.com

Following configuration will help you setup office365.com mail delivery using postfix.
Install required packages.
yum install cyrus-sasl-sql cyrus-sasl-plain cyrus-sasl-lib -y 
append following in /etc/postfix/main.cf
relayhost = [smtp.office365.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_generic_maps = hash:/etc/postfix/generic
smtp_tls_security_level = may
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt
update generic file with sender email address, else office365.com server will reject your mails.
/etc/postfix/generic
@localdomain.local      your_office365_email_id
/etc/postfix/sasl_passwd
smtp.office365.com your_office365_email_id:your_password
restart service
postmap /etc/postfix/generic
postmap /etc/postfix/sasl_passwd
service postfix restart

No comments:

Post a Comment