Office 365 setup

From your office HQ (no authentication)

Make sure to have the DNS settings in place.

Using mycompany.com domain name:

relayhost = mycompany-com.mail.protection.outlook.com:25
smtp_use_tls = yes
smtp_tls_security_level = encrypt
sender_canonical_maps = static:servername@mycompany.com

The sender must be an address from mycompany.com otherwise, it won’t be accepted as a valid sender.
This address does not need to exist, though (it won’t be validated).

From somewhere else

smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = encrypt

sender_canonical_maps = static:yoursender@domain.com

Restart Postfix

service postfix restart
systemctl restart postfix