Help with setting up FreePBX SMTP to work with Office 365

You might want to try changing the From Address in the SysAdmin module to match the one used in the mail log & that you’ve created within the o365 tenant you’re sending from ([email protected]).

I typically ensure these all align.

Also, if all these domains are setup within the same o365 tenant, I assume they all show in the ‘Mail Flow/Accepted Domains’ list of the Exchange Admin Portal, with the ‘Allow Sending’ value showing as YES.

With regards to the Dallas PBX you’re refering to (that works) - If that’s in the same o365 Domain/tenant, then what did you originally set differently here on the non-working PBX ? (I’m assuming something must have been different to start with for it not to work the same - I guess at least the public IP address).

Alright I changed the From Address to [email protected] and ran another debug, results below.

Jul 26 12:48:20 freepbx postfix/pickup[14181]: 7E4F7700E5: uid=995 from=
Jul 26 12:48:20 freepbx postfix/cleanup[21716]: 7E4F7700E5: message-id=[email protected]
Jul 26 12:48:20 freepbx postfix/qmgr[30680]: 7E4F7700E5: from=[email protected], size=517, nrcpt=1 (queue active)
Jul 26 12:48:20 freepbx postfix/smtp[21718]: 7E4F7700E5: host wegmanpartners-com.mail.protection.outlook.com[104.47.55.138] said: 450 4.7.1 Unable to Relay. ATTR37 [BN8NAM12FT013.eop-nam12.prod.protection.outlook.com 2023-07-26T17:48:20.827Z 08DB8D314CADB3ED] (in reply to end of DATA command)
Jul 26 12:48:20 freepbx postfix/smtp[21718]: 7E4F7700E5: to=[email protected], relay=wegmanpartners-com.mail.protection.outlook.com[104.47.59.138]:25, delay=0.46, delays=0.04/0.02/0.36/0.04, dsn=4.7.1, status=deferred (host wegmanpartners-com.mail.protection.outlook.com[104.47.59.138] said: 450 4.7.1 Unable to Relay. ATTR37 [DM6NAM12FT084.eop-nam12.prod.protection.outlook.com 2023-07-26T17:48:20.933Z 08DB8CFAF80EC9C0] (in reply to end of DATA command))

Yes, the domains are setup and set to allow sending, screenshot below.

That’s the thing and what I’m confused about. I have all four of the PBX’s set the exact same but only the one in Dallas seems to actually want to work. The Houston, Chicago and NY PBX systems are the ones having the sending issues. They’re all the same domain (Wegman Partners) but obviously different WAN IP’s since they are different offices. I’m honestly confused how the one in Dallas is even working at this point. If it’s setup like the other three and those are not working, then Dallas shouldn’t be working either.

What is the Location & Public IP address of the PBX we’ve been working on - Is it 216.215.75.54 by any chance ?

If so, this doesn’t have a Reverse Lookup (PTR) record & Google says that’s one of the possibilities for getting a ‘450 4.7.1 Unable to Relay. ATTR37’ error from o365.

Hello and good morning. The WAN IP 216.215.75.54 is an office that I manage but it does not have a PBX system. The one that I’ve been working on is Houston office location and the WAN IP is 216.74.234.162. I just did a reverse lookup, and the DNS record is published by the ISP (Logix). Screenshot below. Also, just wanted to say thanks for taking the time to go back and forth with me and help with recommendations etc. I didn’t think this was going to be so difficult, so I apologize.

Long thread, so maybe I missed it. Have you tried setting your generic file in postfix?

root [email protected]
root@localhost [email protected]
[email protected] [email protected]
root@freepbx [email protected]
[email protected] [email protected]
asterisk [email protected]
asterisk@localhost [email protected]
[email protected] [email protected]
asterisk@freepbx [email protected]
[email protected] [email protected]
asterisk@**phoneserverfqdn.com** [email protected]
vm@asterisk [email protected]

Then in main.cf:

smtp_generic_maps = hash:/etc/postfix/generic

then

postmap /etc/postfix/generic

I think you are trying to solve this problem at the wrong end. This is Microsoft 365 rejecting the email because of an email domain that it thinks it’s not allowed to relay through the tenant. You need to figure out with Microsoft 365 how to configure it so that you can relay with the two domains that you have setup in the tenant.

I didn’t do this on the PBX in Dallas that is working so I didn’t try this on the PBX’s that aren’t working. I’m more confused on why it’s sending as [email protected] when that’s definitely not the address I have inputted.

Ok I’ll try that but MS is an absolute nightmare to work with. Bunch of offshore support people with little experience.

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