When I use a TTMSFNCCloudMicrosoftOutlookMail to send an email, set all values then call "Connect", with the OnConnected event calling "SendMessage", everything works fine if the authentication is successful.
However, if the authentication fails (e.g. wrong details for ClientID, Secret) or the user closes the browser tab, how on earth do I detect that it has not been successful?
Creating a thread to monitor the TTMSFNCCloudMicrosoftOutlookMail to detect "OnAuthenticated" or "OnConnected" with a timeout seems horribly clunky - is there some way to detect that the request has not succeeded?
The authentication happens in the browser on a Microsoft owned domain for security reasons. This is standard OAuth2 protocol. Before the redirect to the callback URL the TTMSFNCCloudMicrosoftOutlookMail component has no knowledge of what is happening in the browser. Any errors at this stage are displayed in the browser instead of in the application.
This is a technical Windows limitation which we have no control over. The same goes for a scenario where the user closes the browser tab.
If an issue occurs after authentication the OnAccessDenied error will get triggered.
The application could display a message after Connect is called that informs the user that no email will be sent as long as the authentication process has not finished successfully.