Configuring sendmail to send email to Outlook server
Solution 1:
First, you need to add Partner Connector in the Office365 Exchange Admin center. Then add your server IP address there.
Now in your SendMail MTA Configuration add this
define(`SMART_HOST',`[MX-OF-YOUR-OFFICE365-DOMAIN]')dnl
define(`RELAY_MAILER_ARGS', `TCP $h 25')dnl
define(`ESMTP_MAILER_ARGS', `TCP $h 25')dnl
define(`confAUTH_OPTIONS', `A p')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
FEATURE(`authinfo', `hash -o /etc/mail/authinfo.db')dnl
Make sure you replace MX-OF-YOUR-OFFICE365-DOMAIN using your domain Office365 MX.
If you like to use Office365 Auth Client, follow this.
Update Access with Office365 SMTP User ID Pass
sudo nano /etc/mail/authinfo/office365-auth
AuthInfo: "U:root" "I:[email protected]" "P:YOUR-PASSWORD"
Generate hash file using Auth File
sudo makemap hash /etc/mail/authinfo.db < /etc/mail/authinfo/office365-auth
Regenerate DB File sudo makemap hash /etc/mail/access.db < /etc/mail/access
After that issue
make -C /etc/mail
/etc/init.d/sendmail reload
Try to send mail afterward.