If you want to use Office 365 as your SMTP email server for a 3CX PBX you are best setting up a Connector on the Exchange Online account. I am assuming that your PBX is on the end of a static IP address.
First configure your 3CX server. Under Email and settings set the mail server to match your MX record. This usual follows the format domain.mail.protection.outlook.com where domain is your email domain with hyphens instead of dots.
Set a reply to address on the same domain. I always use pbx @ sfax.co.uk, it doesn’t go anywhere, I don’t expect anyone to reply to it.
You don’t need a username or password or to enable SSL/TLS as we will set up a connector to receive the email.
Next log on to your Office 365 portal as an administrator, and open your Exchange Admin Center. From there pick connectors under mail flow.
Create a new Connector.
Pick from: Your organization’s email server
To: Office 365
Give it an appropriate name:
Next select By Verifying that the IP address of the sending server matches one of these addresses that belong to your organization
Click the plus to add an IP address and enter your PBX’s internet IP address
Save the connector and you are good to go.