Using MS Exchange as E-mail Server#
Before you start with the MS Exchange configuration make sure you have followed the instructions given for the basic MS Azure/Allegra integration setup.
Then follow the procedure shown in the video below.
The integration flow is as follows:
In Allegra, navigate to Administration perspective > Server configuration > [Outgoing email | Incoming email]
Select the MS Exchange option
Click to “Link Ms Exchange to Azure account” button. Based on the configured MS Azure integration fields, Allegra assembles and redirects the user to the following URL:
https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0/authorize?scope=openid+profile+offline_access+{MAIL_SCOPES}&response_type=code&redirect_uri={ALLEGRA_URL}msExchangeAuthCallback.action&state={STATE}&nonce={NONCE}&prompt=select_account&client_id={MS_AZURE_APP_ID}&response_mode=query
The MAIL_SCOPES parameter is configurable, the default value is: https://outlook.office.com/IMAP.AccessAsUser.All,https://outlook.office.com/SMTP.Send`
After you have accepted the required permissions and have entered your credentials you are redirected back to Allegra.
The web redirect URI for MS Exchange is
{YOUR_ALLEGRA_URL}/msExchangeAuthCallback.action
Technical Background#
- After successfully executing the last step of the procedure described
above Allegra receives an “authorization code” from Microsoft. Using this “authorization code” the system acquires a token. This token can be deserialized into a JSON string and contains different type of tokens:
AccessToken
RefreshToken
IdToken etc.
These tokens are used to obtain other tokens for authenticating Allegra as a mail client (acquire token silently).
When Allegra connects to the outgoing mail server it uses the previously acquired token to authenticate (issueCommand operation in Java mail SDK) with the mail server and then sends the mail.