The From field in MSPbots emails, notifications, and reports is customizable to use your company email instead of the default support@mspbots.ai. This article shows how to change the sender's email address using the OAuth2 method for more secure authorization.
Background information
OAuth (Open Authorization) 2.0 is the modern standard to allow a website or application to access resources hosted by other web apps on behalf of a user. It adds security by providing consented access and restricting client actions performed on resources without sharing the user's credentials.
Now that basic authentication will be disabled and OAuth 2.0 is the new de facto industry standard for online authorization, MSPbots offers an option to add an extra authentication step in setting up the SMTP configuration for modifying the From field address for outgoing emails and sending reports. Users now have the option to use OAuth 2.0 in the Outgoing Mail settings.
If you prefer using only the basic authentication to modify the Outgoing Mail settings, refer to the article How to Configure the Outgoing Mail Using Basic Authentication.
Prerequisites for editing the Outgoing Mail settings
You must have the following to perform the procedure below:
- Admin permissions
- Inclusion in the Azure Active Directory (AAD)
- Outlook 365 license
- Application and developer roles for configuring the AAD
Gathering the MS OAuth 2.0 credentials for authorization
Follow these steps to generate the required information:
- Prepare the redirect uniform resource identifier (URI) which is https://app.mspbots.ai/web/um/smtp/redirect. Once the authorization is successful, Microsoft will use this URI to notify MSPbots about the authentication result.
You can find this information with the following steps:
-
Go to Settings > System > Outgoing Mail in MSPbots.
-
Click v icon beside the +Add button and select OAuth2.
-
When the Add window opens, copy and save the url of Redirect URI to your Desktop. You will need this later when adding a New registration.
-
- Sign in to the Microsoft Azure portal and secure the credentials needed for the OAuth 2.0 authorization.
-
Create a new app registration.
-
On the Microsoft Azure homepage, click App registrations. If you can't find App registrations on the page, search for it in the search bar.
-
When the App registrations page opens, click the +New registration tab.
-
In the Register an application form:
-
Name - Enter a unique name for your application.
-
Supported account types - Select Account in this organizational directory only (MSPbots.ai only - Single tenant) from the options.
-
Redirect URI (optional)
-
Select Web.
-
In the second box, enter the Redirect URI copied from Step 1.c.
-
-
Click Register.
-
-
-
Next, go to Certificates & secrets on the sidebar menu, then click +New client secret on the right under the Client secrets tab.
-
In the Add a client secret window:
-
Description - Add a description.
-
Expires - Select an expiry date from the dropdown menu.
Before the secret expires you must create a new secret and apply it to the MSPbots Outgoing Mail settings. - Click Add located at the bottom of the Add a client secret window.
-
-
The addition is successful once the Update application credentials pop-up window appears.
-
Click the copy icon in the Value column to copy the value to Notepad and save it on your Desktop. You will need this value later when configuring OAuth 2.0 in the mail settings.
-
-
Next, go to API Permissions on the sidebar menu.
- Click the +Add a permission button.
- In requesting API permissions window, go to the Microsoft APIs tab and select Microsoft Graph.
- Next, select Delegated permissions.
- Enter SMTP in the search bar under Select permissions, then click SMTP and select SMTP.Send.
- Enter IMAP in the search bar under Select permissions, then click IMAP and put a checkmark IMAP.AccessAsUser.All.
- Click the Add permissions button.
- The permissions you added will appear in the Configured permissions list.
- Click the +Add a permission button.
- Next, go to the Overview.
-
Click the copy icon next to the Application (client) ID to copy the value to Notepad and save it on your Desktop. You will also use this value for creating the OAuth 2.0 credential in the mail settings.
- Click the Endpoints tab.
- Copy the OAuth 2.0 authorization endpoint (v2) and the OAuth 2.0 token endpoint (v2) to Notepad and save it on your Desktop, such as Notepad. You will also use these values for creating the OAuth 2.0 credential in the mail settings.
-
Click the copy icon next to the Application (client) ID to copy the value to Notepad and save it on your Desktop. You will also use this value for creating the OAuth 2.0 credential in the mail settings.
Setting up OAuth 2.0 in MSPbots
- Open the MSPbots app.
- Go to Settings > System, and click Outgoing Mail in the upper right corner of the System page.
-
Click v icon on the right side of the +Add button and select OAuth2.
- Fill in the following fields in the Add window.
- Host Name - This value is pre-filled.
- Authorization URL and Token URL - Use the values from Step 6.c of the previous section.
- Redirect URI - This value is pre-filled.
- Client ID - Use the values from Step 6.a of the previous section.
- Client Secret - Use the values generated in Step 4.c of the previous section.
- Username - Enter your username.
- Reply to - Enter your preferred email.
-
Signature - Input your signature.
- Click Authorize.
If you want to authenticate OAuth 2.0 with another account, refer to How to authenticate OAuth 2.0 with another account.
However, ensure that the account must belong to the same domain as yours. For example, abc@mspbots.ai and def@mspbots.ai are accounts from the same domain. - The page will automatically redirect to the Microsoft login screen. Enter the user password you provided in the OAuth 2.0 credentials and click Sign in.
- Click Accept in the Microsoft pop-up window requesting permissions for MSPbots.
- The message Authentication successful oauth redirect success appears.
Verifying if the authentication is successful
Go back to MSPbots and refresh the Outgoing Mail page to verify if the configuration works.
The mailbox status should show Verified for a successful authentication.
If the status is Not Verified, repeat Setting up OAuth 2.0 in MSPbots until the authorization is successful.
To authenticate OAuth 2.0 with another account, follow the steps below. Ensure that the account belongs to the same domain as yours. For instance, abc@mspbots.ai and def@mspbots.ai are accounts from the same domain.
- Click Next.
- Click Next or Skip setup based on your needs.
- Click Accept.
- When Authentication successful oauth redirect success appears, it means successful authentication.
- Back to System in MSPbots and click the Refresh button to refresh the page.
- Click Outgoing Mail.
- The status of the user you authenticated will change to Verified.
- If you want to verify whether OAuth 2.0 authentication with non-MSPbots accounts was successful, refer to How to Create Scheduled Reporting for Dashboards and Reports to send an email to verify if it was sent from the account you authenticated.