Mark Berry October 9, 2014
I use the Windows SMTP service to relay some mail to Office 365 and, from another site, to Google Apps Gmail. Here are some notes and links on both.
The default outbound message size limit is 2MB. If you’re sending larger messages, increase that on the Messages tab:
Set up shortcuts to the SMTP Logs and SMTP folders (including Badmail and Queue):
Badmail and Queue: C:\inetpub\mailroot
Office 365 Smarthost
- There are ways to set up a connector to trust all mail coming from a certain server. Since I’m dealing with servers behind dynamic IP addresses, I did not want to use this approach.
- The other approach is to authenticate as an Office 365 user (using the user’s email address and password). This does not require any additional configuration in the Office 365 portal. However, this does seem to require that the mail itself come From that user, i.e. if your Office 365 account is email@example.com, your device (printer, router, UPS, whatever) must send notification emails from that same firstname.lastname@example.org address.
- Mail must be sent to smtp.office365.com using TLS on port 587.
- See also my article last year on SMTP service certificates.
Google Apps Gmail Smarthost
Google Apps does require some configuration in the portal to allow relaying. This is described in their article SMTP relay service setting.
Google is a little more flexible: you can make TLS optional (I set it as required) and it may work on other ports (I stuck with 587). You still set up the SMTP service to authenticate as a Gmail user, but it does seem to allow for the email to come From another valid user in the domain. In other words, I set authentication in the SMTP service to connect as email@example.com, but mail from the Linux server is coming From firstname.lastname@example.org
The Google server is smtp-relay.gmail.com.
Sending from Linux
Mail from the Linux “root” user will by default be sent From email@example.com, which Google (and probably Office 365) would reject.
So how do you get the Linux box to send as a known user in your email domain, e.g. firstname.lastname@example.org? I got that to work by setting up smarthost, domain masquerading, and “address rewriting” using generics, telling it that mail from “root” was actually from email@example.com. This article describes editing the sendmail.mc file. I edited sendmail.mc manually, then used Webmin to get it to rebuild the Sendmail M4 Configuration. Webmin also let me set up the Outgoing Addresses and Aliases.