Hi @Thilina CL
Register the application in Azure by referring to this document. After registration, you can view clientID and tenantI in Overview. For Client secrets, you can manually add them in Certificates&secrets.
For sending mails, you need to add Mail.Send permission. For more information, see this document.
The recommended methods for obtaining tokens are auth code flow and client credentials flow
Auth code flow requires the user to log in interactively, and the application can only send emails on behalf of the logged in user.
Client credentials flow does not require the user to log in, but requires the administrator to grant the application permission Mail.Send, which can send messages on behalf of any user.
Hope this helps.
If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.