Office365 Troubleshooting

So I saw the other thread about user not being able to get Office365 to work. I also have never been able to get Office365 to work in Sysadmin Pro>Email Setup and it has been a frustration of mine. I have to use a generic Gmail acct which does work.

Here is my setup for Office365 that fails… Any help on getting this to work would be much appreciated…

Imgur

Imgur

Here is the debug when I send a test email… I changed my domain to “mydomain.com” in the debug fyi

Jul 28 15:16:19 voip postfix/pickup[28970]: 62C84419FAFF: uid=999 from=
Jul 28 15:16:19 voip postfix/cleanup[31177]: 62C84419FAFF: message-id=[email protected]
Jul 28 15:16:19 voip postfix/qmgr[28963]: 62C84419FAFF: from=[email protected], size=423, nrcpt=1 (queue active)
Jul 28 15:16:20 voip postfix/smtp[31179]: warning: smtp.office365.com[52.96.44.162]:587: response longer than 2048: 554 5.2.252 SendAsDenied; deac…
Jul 28 15:16:20 voip postfix/smtp[31179]: 62C84419FAFF: to=[email protected], relay=smtp.office365.com[52.96.44.162]:587, delay=1.1, delays=0.03/0.02/0.81/0.27, dsn=5.2.252, status=bounced (host smtp.office365.com[52.96.44.162] said: 554 5.2.252 SendAsDenied; [email protected] not allowed to send as [email protected]; STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message [BeginDiagnosticData]Cannot submit message. 0.35250:1E460000, 1.36674:01000000, 1.61250:00000000, 1.45378:02000000, 1.44866:00000000, 1.36674:7A000000, 1.61250:00000000, 1.45378:05000000, 1.44866:00140000, 1.36674:0A000000, 1.61250:00000000, 1.45378:16000000, 1.44866:6B1B0000, 1.36674:0E000000, 1.61250:00000000, 1.45378:841B0000, 1.44866:F6010000, 16.55847:D20D0000, 17.43559:0000000030020000000000000000000000000000, 20.52176:140F5295190070201F001336, 20.50032:140F52958917101032000000, 0.35180:03000136, 255.23226:0A000000, 255.27962:7A000000, 255.27962:0A000000, 255.27962:0E000000, 255.31418:4A000000, 0.35250:4800D13D, 1.36674:0A000000, 1.61250:00000000, 1.45378:02000000, 1.44866:92000000, 1.36674:32000000, 1.61250:00000000, 1.45378:97000000, 1.44866:01000000, 16.55847:0D010000, 17.43559:0000000090030000000000000000000000000000, 20.52176:140F52951900101070000000, 20.50032:140F52958917000003003600, 0.35180:75000000, 255.23226:0A004366, 255.27962:0A000000, 255.27962:32000000, 255.17082:DC040000, 0.27745:0A004200, 4.21921:DC040000, 255.27962:FA000000, 255.1494:0A006400, 0.38698:0F010480, 1.41134:46000000, 7.36354:010000000000010B86000000, 0.37692:01000000, 0.37948:4D000100, 5.33852:00000000534D545000000000, 7.36354:010000000000010901000000, 4.56248:DC040000, 7.40748:010000000000010B01000000, 7.57132:000000000000000086000000, 4.39640:DC040000, 1.63016:32000000, 8.45434:02CEB00F29859648BB522D98FE4401BA902A39E3, 1.46798:04000000, 5.10786:0000000031352E32302E353435382E3032353A424C30505231314D42333434313A62646330396232342D653764372D346664362D6
Jul 28 15:16:20 voip postfix/cleanup[31177]: 82470419FB02: message-id=[email protected]
Jul 28 15:16:20 voip postfix/bounce[31180]: 62C84419FAFF: sender non-delivery notification: 82470419FB02
Jul 28 15:16:20 voip postfix/qmgr[28963]: 82470419FB02: from=<>, size=6531, nrcpt=1 (queue active)
Jul 28 15:16:20 voip postfix/qmgr[28963]: 62C84419FAFF: removed
Jul 28 15:16:20 voip postfix/smtp[31179]: connect to smtp.office365.com[2603:1036:302:4832::2]:587: Network is unreachable
Jul 28 15:16:21 voip postfix/smtp[31179]: warning: smtp.office365.com[52.96.182.114]:587: response longer than 2048: 554 5.2.252 SendAsDenied; deac…
Jul 28 15:16:21 voip postfix/smtp[31179]: 82470419FB02: to=[email protected], relay=smtp.office365.com[52.96.182.114]:587, delay=1.2, delays=0/0/1.1/0.18, dsn=5.2.252, status=bounced (host smtp.office365.com[52.96.182.114] said: 554 5.2.252 SendAsDenied; [email protected] not allowed to send as [email protected]; STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message [BeginDiagnosticData]Cannot submit message. 0.35250:1E460000, 1.36674:0A000000, 1.61250:00000000, 1.45378:02000000, 1.44866:AA430000, 1.36674:0E000000, 1.61250:00000000, 1.45378:AF430000, 1.44866:1C130000, 16.55847:1D260000, 17.43559:0000000024020000000000000000000000000000, 20.52176:140F52951900F01F00000000, 20.50032:140F52958917F01F0200BB30, 0.35180:140F5295, 255.23226:07020000, 255.27962:0A000000, 255.27962:0E000000, 255.31418:0A020000, 0.35250:1F001432, 1.36674:0A000000, 1.61250:00000000, 1.45378:02000000, 1.44866:B0000000, 1.36674:32000000, 1.61250:00000000, 1.45378:B5000000, 1.44866:01000000, 16.55847:2B010000, 17.43559:0000000090030000000000000000000000000000, 20.52176:140F52951900F01F62020000, 20.50032:140F52958917001000000000, 0.35180:DF020000, 255.23226:2C000000, 255.27962:0A000000, 255.27962:32000000, 255.17082:DC040000, 0.27745:2C000000, 4.21921:DC040000, 255.27962:FA000000, 255.1494:0C000000, 0.38698:46000000, 1.41134:46000000, 7.36354:010000000000010B46000000, 0.37692:01000000, 0.37948:01000000, 5.33852:00000000534D545000000000, 7.36354:010000000000010907000001, 4.56248:DC040000, 7.40748:010000000000010B07000001, 7.57132:000000000000000086000000, 4.39640:DC040000, 1.63016:32000000, 8.45434:02CEB00F29859648BB522D98FE4401BA54020000, 1.46798:04000000, 5.10786:0000000031352E32302E353435382E3032353A424C30505231314D42333434313A62646330396232342D653764372D346664362D626530392D3531353966613862643564633A313134303800, 7.51330:C9F418A8CD70DA0812A5E0A6, 0.39570:86000000, 1.55954:0A000000, 0.49266:06000000, 1.33010:0A000000, 2.54258:
Jul 28 15:16:21 voip postfix/qmgr[28963]: 82470419FB02: removed

I have no experience with 365, but this wiki resource may be of value in case you’ve not seen it: How to setup FreePBX to work with Office 365 Exchange Email - FreePBX Documentation - Documentation

Have you enabled the relay in Office365? I think you need to add the IP address to 365 to allow it.

Well weird enough…even though debug fails I just got a Fail2Ban email from the PBX sent from my Office365…hmmm

I always use direct send in postfix so this may not apply, but have you tried adding a connector for your PBX IP address in 365?

You do not need a connector if you are authenticating.

This failed to send a test because [email protected] is not allowed to send as [email protected]

You can fix this by setting up /etc/postfix/generic to fix random alias names to be something acceptable.
Some examples:

root [email protected]
[email protected] [email protected]
[email protected] [email protected]
[email protected] [email protected]
[email protected] [email protected]
asterisk [email protected]
[email protected] [email protected]
[email protected] [email protected]
[email protected] [email protected]
[email protected] [email protected]
[email protected] [email protected]
[email protected] [email protected]
@pbx.domain.com @domain.com

The weird part is Im getting F2B emails ever since setting up Office365 again yesterday even though the Debug failed. But I am not receiving VM to email… Not sure how thats possible, I would think email is either working or not…

“From:” addresses are set in a couple different places.

System Admin → Notification Settings

Voicemail Admin → Settings → Email Config → Server Email

Make sure these are all set as you want them to be.

1 Like

Bingo! Thank you!

This was the culprit for Office365 VM to Email to start working. Never even knew that was there…

Voicemail Admin → Settings → Email Config → Server Email (Enter Office365 email address here)

So the only email I havent been getting now is Updates Available… Is that setting hidden somewhere else?

Admin → Updates → Scheduler and Alerts to set where the notices are sent.

Thx. I had the right email in there… I had automatic updates Disabled instead of Email Only… And the others set to Enabled instead of Email. So I changed all them to Email only. We will see how that plays once more updates are available as my box is fully updated…

Appreciate the help

For my installs I always rewrite the sender to whatever 365 account you are using. This way ALL email addresses are rewritten and go through.

Create an smtp_header_checks file via an echo or nano

echo “/^From:.*/ REPLACE From: PBX Display Name [email protected]” > /etc/postfix/smtp_header_checks
Add the following code to the end of main.cf:

header checks to rewrite

smtp_header_checks = pcre:/etc/postfix/smtp_header_checks

From this (my site): WD Knowledgebase - Enable Relay and Rewrite Sender for Postfix in FreePBX for Microsoft 365 or Google Workspace

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.