Unable to connect my o365 email from ODK Central

1. What is the issue? Please be detailed.
To reset the password, I want that email should be sent from my O365(office365) account, whenever my web user request to update the password. However, after updating files/service/config.json.template with my Office365 SMTP setting I am getting an Error 502 code on the server.

2. What steps can we take to reproduce this issue?
Check smtp port from here : https://support.google.com/a/answer/176600?hl=en#zippy=%2Cuse-the-gmail-smtp-server and https://support.microsoft.com/en-us/office/pop-imap-and-smtp-settings-8361e398-8af4-4e97-b147-6c6c4ac95353

my smtp settings are below

smtp: smtp.office365.com
port: 587

3. What have you tried to fix the issue?
update a few settings of my O365 account. When I am using my Gmail account then I am able to get password reset email but in the case of the office365 setting, I am getting Error code 502.

4. Upload any test forms or screenshots below.
NA

Looking for your help.

Best,
@iamnarendrasingh

Is this a personal Office365 account or one managed through an organization's IT department? IT will often have policies that reduce/remove certain functionalities. For example, our organization removes the "publish to web" for PowerBI.