Microsoft 365 mail sender
Overview
IMPORTANT: This service is available as of Sitefinity CMS version 14.4.8123. Dependency mismatch is possible in case the order of the steps in this article is not followed.
You can configure your notification profile to use Microsoft 365 and SMTP servers. First, you must register your application in Microsoft Entra ID and ensure it has the proper permissions.
- Create or use your Microsoft Exchange registration to access the Azure portal. For more information, see Microsoft documentation » Exchange Online.
- Log in to the Azure portal at https://portal.azure.com/ with your registration where you Microsoft Entra ID resides in.
- Go to Microsoft Entra ID and add a new app registration.
For more information, see Microsoft documentation » Register an app with Microsoft Entra ID.
- For RedirectURI add https://www.microsoft.com/en-us/microsoft-365/exchange/exchange-online and from the dropdown box, choose Web.
- Once the app is registered, open it to add API permissions.
- Add the following Microsoft Graph permissions as application permission type:
Mail.Read
Mail.ReadBasic
Mail.ReadBasicAll
Mail.ReadWrite
Mail.Send
For more information, see Microsoft documentation » Delegated permission to Microsoft Graph.
- From the APIs your organization use, add the following Office 365 Exchange Online permission as application permission type:
- Create a new secret.
For more information, see Microsoft documentation » Add a client secret.
Make sure to save the secret value for later as you need it to complete the setup.
- Get your Application (client) ID and Directory (tenant) ID from your newly registered app overview page in Microsoft Entra ID.
Installation
You must install a custom notification sender project to be able to use your Microsoft 365 app with Sitefinity CMS. Perform the following:
- Download the mail sender solution from this GitHub repository.
- Copy the Progress.Sitefinity.Office365.Mail.Sender folder and paste it in the same directory as your Sitefinity CMS solution.
- Open your Sitefinity CMS solution with Visual Studio.
- In case the mail sender project is not visible under your Sitefinity CMS solution, import it manually by right clicking on the solution » Add » Existing project.
- Add a reference to the mail sender project from your
SitefinityWebApp
.
- Build the entire solution.
To use the Microsoft 365 mail sender, you must install Microsoft.Graph.Core
in your SitefinityWebApp
project using the following command:
Install-Package Microsoft.Graph.Core -Version 3.0.6
This is done to ensure there are no dependency conflicts between the mail sender and your Sitefinity CMS project.
Set up the Mail Sender in the Sitefinity CMS backend
Finally, you need to configure the new profile in Sitefinity CMS backend.
- Go to Administration » Settings » Advanced » Notifications » Profiles.
A new profile called Office365 is now available.
- Add the respective values to the fields TenantId, ClientId, and ClientSecret in this profile.
- Fill out the DefaultSenderEmail and the Host fields as they are required for the service.
For the Host field you can fill out Office365 for example.
- Save your changes.
- Go to Notifications » DefaultProfiles » smtp.
- Set the new ProfileName to be Office365.
- Save your changes.
To use email campaigns, you need to configure the Office365 profile as the Newsletters SMTP profile:
- Navigate to Administration » Settings » Advanced » Newsletters.
- Type Office365 in the Notifications SMTP Profile field.
- Click Save Changes.
Test the mail sender
To test the mail sender, perform the following:
- Navigate to Administration » Settings » Email settings.
- Click Send Test Email.
- Fill out the email that would receive the test message.
- Click Send test.