If you’ve tried to configure the FreePBX phone system to send emails through a Office365 account, you probably ran into a few roadblocks. There are a number of ways to work around these issues, but this post describes the method I have found to be the easiest.
First, identify an existing Office365 account that will be used to relay the email messages, or create a new one for that purpose. For example purposes, we’ll assume this account has an email address of firstname.lastname@example.org.
Under Admin >System Admin > Email Setup, set the following options:
- SMTP Server: Use External SMTP Server
- My Hostname: leave as default (blank is fine)
- My Origin: leave as default
- My Domain: leave as default
- Provider: Office 365
- Username: email@example.com
- Password: (enter the password for the email account)
Under Settings > Voicemail Admin > Settings > Email Config, set Server Email option to firstname.lastname@example.org.
Note: this step may or may not be required. The system doesn’t seem to actually honor this setting. If it did, the following steps would not be necessary.
Add these lines to the end of the file /etc/postfix/generic. This is not accessible from the GUI, so you’ll need to do it from the command line. I usually sign in using Putty or WinSCP so you can just modify the text to suit you and then past it in.
Add the following to the end of the file /etc/postfix/main.cf
smtp_generic_maps = hash:/etc/postfix/generic
Then run these two commands:
service postfix restart
That’s it! The FreePBX system now be able to send emails.