Redhat – How to configure sendmail to relay emails through Office 365 (SMTP) with TLS

microsoft-office-365redhatsendmailsmtptls

I have a box running RHEL 6.3 and there's and application that needs to send out reports by mail, in order for this functionality to work I have to have mail configured in my box. In addition I thought it would be nice to receive my root alerts to my regular email instead of having to log into the box.

I have an Office 365 account created for the sole purpose of being used as the relay.

Office 365 SMTP Details:

SMTP: pod51011.outlook.com Port:587 Encryption: TLS

What I tried:

- Defined the SMART_HOST in the sendmail.mc
- Generated and configured sendmail certificates
- Created the AuthInfo file with SMTP credentials
- Eliminated from sendmail.mc localhost's loopback
- Got frustrated because even thought I configured everything (using different guides) sendmail kept trying to send them throught localhost.

After 8 hours of multiple tries:

- Gave up on sendmail and slept 12 hours due to a massive headache.
- Decided to use SSMTP (because sendmail was a PITA) and people said SSMTP was easy to configure.
- Configured SSMTP and for some reason SASLAUTH said it couldn't connect to the SMTP.
- Got frustrated again and uninstalled SSMTP.

And here I am, seeking for assistance cause I want to beat sendmail! Can anyone point me in the right direction?

Best Answer

I also tried doing this with sendmail relaying via gmail, but opted to use postfix instead as it seemed MUCH more simple to setup. You dont have to go through the process of creating self signed certificates etc.. This howto is for gmail, but the process should be very similar for Office 365. Just a matter of finding out the server names, and authentication scheme. http://rs20.mine.nu/w/2011/07/gmail-as-relay-host-in-postfix/ Geo