Sending mail from ERPNext using M365

I am configuring the oAuth app (connected app). I have configured all the parameters as per the app registration in Azure website. I am getting below error
“Please check your email login credentials. smtplib.SMTPAuthenticationError: (451, b’4.7.0 Temporary server error. Please try again later. PRX5 [MA0PR01CA0068.INDPRD01.PROD.OUTLOOK.COM 2024-05-15T14:57:39.821Z 08DC7481A6131185]')”
I do not want disable microsoft default security. therefore basic authentications are not allowed