This plugin provides a Microsoft Graph mailer adapter for Craft CMS.
This plugin requires Craft CMS 5.8.0 or later, and PHP 8.2 or later.
You can install this plugin from the Plugin Store or with Composer.
Go to the Plugin Store in your project’s Control Panel and search for “Microsoft Graph Mailer”. Then press “Install”.
Open your terminal and run the following commands:
# go to the project directory
cd /path/to/my-project.test
# tell Composer to load the plugin
composer require craftcms/microsoft-graph-mailer
# tell Craft to install the plugin
./craft plugin/install microsoft-graph-mailer- Microsoft Azure Portal account
- Microsoft 365 licensed mailbox
- Log in to your Azure Portal account.
- Navigate to Azure Active Directory (Entra).
- Go to Manage → App registrations and press New registration.
- Give your app a Name.
- Under Supported account types, select Accounts in this organizational directory only (Single tenant).
- Press Register. The app will be created, and you’ll be taken to its overview page.
- Beside Client credentials, press Add a certificate or secret.
- Under Client secrets, press New client secret. Give it a description and preferred expiration timeframe, then press Add.
- Copy the Application (client) ID, Directory (tenant) ID, and the secret Value somewhere safe. You’ll need these values to configure the Craft CMS mailer.
Note
It won’t be possible to re-retrieve the secret’s value once you’ve left the page.
- Go to Manage → App registrations → [your app] → Manage → API permissions and press Add a permission.
- Under Microsoft APIs, select Microsoft Graph.
- Select Application permissions (not Delegated).
- Select the checkbox for Mail → Mail.Send.
- Press Add permissions. The permission will show in the table with a status of “Not granted for [your organization name]”.
- Press Grant admin consent for [your organization name]. The permission should now show in the table with a status of “Granted for [your organization name]”.
Once Microsoft Graph Mailer is installed:
- Go to Settings → Email.
- Change the Transport Type setting to Microsoft Graph Mailer. Also, ensure that your System Email Address in your Craft Email Settings matches the licensed mailbox you want to send emails from.
- Enter your Azure App Client ID (Application (client) ID).
- Enter your Azure App Client Secret (secret Value).
- Enter your Azure App Tenant ID (Directory (tenant) ID).
- If you need to use graph and auth endpoints other than the default, you can fill out Graph Endpoint and Auth Endpoint fields.
- If you want to save the messages to sent items, toggle Save to sent items on.
- Click Save.