Email via Office365

Hi all,

I am trying to set up a PBX to use Office365 as the email sender. I am using the Paid commercial module ‘System Admin’ and I just cannot get things to stay working.

I have sorted out a few things with this setup, first of all for some reason postfix was trying to resolve the office365 SMTP address as an IPv6 address, so a quick edit of the mail.cf fixed this.

But I am currently stuck on a problem where the only way I am able to get emails to send is by adding this to the config file: smtp_sasl_security_options = no anonymous

However, if I make any changes at all to the email setup on the PBX via the System Admin page this specific line is removed from the config… my other changes have stayed, but this one is always removed - no matter where I place it!

At this point my only option is to make sure no-one has to edit any settings on the email page… but I just know that sometime down the track something will change and this edit will have been forgotten and emails will stop working.

Is there a good reason why this line is being removed? because without it I am getting the following errors:

May 12 15:10:30 pbx postfix/smtp[9188]: 09C7241034: SASL authentication failed; cannot authenticate to server smtp.office365.com[132.245.164.242]: no mechanism available May 12 15:10:30 pbx postfix/smtp[9188]: warning: SASL authentication failure: No worthy mechs found

Any help on this would be really appreciated.

Do you have a internal relay server ?

I use office 365 but it’s a paid service

If not you can go into the office365 admin console( if you have access and add your ip to the allow list.

Hi @jarvisswope … not really too sure what you are getting at here. The email works fine if I add that line mentioned in my first post to the config, but whenever you change any of the email settings via the FreePBX GUI (From Admin > System Admin > Email Setup) this line is removed - which breaks the config.

Do you have access to the office 365 console

I do not, I only have access to the email account that was setup for me or this purpose.

Have you followed this guide

http://wiki.freepbx.org/display/FPG/System+Admin+-+Email+Setup#SystemAdmin-EmailSetup-SMTPServer

Yes, I have.

Do you have this setup and working with your Office365 account?

That sounds like a pretty simple fix. So you’re saying that if you pick ‘other’ and put your credentials in it works, as long as you add that one extra line?

Also:

That’s perfectly normal. All machines will always try to connect to any IPv6 address first. It will immediately get a ‘no route to host’ or ‘network unreachable’ and then try the IPv4 address. Lots of people see that first error and go ‘Oh, my email is broken!’ and then don’t read the next two lines where the REAL error is.

Hi @xrobau,

Yea everything is happy with my setup as long as I add smtp_sasl_security_options = noanonymous to /etc/postfix/main.cf. But this keeps getting removed when you change a setting via FreePBX UI :unamused:

I was seeing the network errors when it was trying to resolve the IPv6 address, but it was failing and not moving on at all - its like it was not falling back to IPv4. So disabling IPv6 in /etc/postfix/main.cf fixed that.

Yes I do have it working I have 4 pbxs and they all send voicemail to email and backup emails to me. Try this go to Settings | Voicemail admin | Settings and look for serveremail and change it to [email protected] and then settings | advanced settings look for Email “From:” Address.

I had to change both of them to match my email domain name or office 365 rejected them.

@jarvisswope yeah, I had already updated those but it made no difference. So I am overwriting the from address using postfix smtp_generic_maps option.

The main issue/reason I opened this topic was to find out why this one line that I add to the /etc/postfix/main.cf file is being removed… other things that I add or edit in this file are left untouched.

I didn’t have to do anything with postfix or the email setup in sys admin just set from address and off she went

which version of postfix are you running?

I have 2.6.6 installed from the latest distro image. And according to yum there are no updates for it.

I don’t know why I have to make the changes to the main.cf file and you don’t… Or are you not setting this up as an ‘External SMTP Server’?

I am not setting this up as a external smtp server. Howerver i verifyed my settings and i had to add my ip to the office 365 console to alllow all main from my ip to be accepted.

Sorry for the confusion

OK, if you feel like giving this a test, I’ve just added O365 support to sysadmin. Try this:

fwconsole --edge ma downloadinstall sysadmin

That should install Sysadmin 13.0.56.2 which has a nice Office 365 button that - if what you said is right - should work. I can’t really test it, as I don’t have O365 access, but if you can verify that it works for you, that would be awesome.

1 Like

@xrobau You are a champ!

I have updated and I see the option there for Office365, however I need to be able to put in my username and password (Similar to Gmail). Can these options be exposed for O365?

That’s there. Your browser probably hasn’t seen the updated javascript. Do a shift-reload and it should work.

Ah! (I had to clear the cache for this site - using Safari).

@xrobau You are my new favourite person. Just tested the setup and it works awesomely! Thank you so much for the extremely fast work here :grinning:

1 Like

Nice… I am going to do some more testing with FREEPBX and Office 365. I never have had any issues sending mail from freepbx with office 365.

But at least @xrobau got it working for you.

1 Like

make your life easy. setup up a connector on office 365 for your pbx. one of the connector types allows you to use the office 365 exchange server as a relay server. you put in the static ip of your pbx and use the mx record as the smtp server address. typically this connector is used to enable things like copiers, etc to be able to send email. the great thing about it is that it does require that you have an office 365 license for your device. you do want to be careful, especially if your pbx is behind a firewall that also has other devices.

if you don’t want to use office 365 as a rely server, then make sure that you have reverse dns setup for the domain you are sending from.