madebythink/craft-microsoft-365-mail-transport
Composer 安装命令:
composer require madebythink/craft-microsoft-365-mail-transport
包简介
Microsoft 365 Mail Transport plugin for CraftCMS developed by Think
README 文档
README
This plugin allows Craft CMS to send email using the Microsoft Graph API, authenticating with OAuth 2.0.
Requirements
- Craft CMS 5.0+
- PHP 8.0+
- An Azure Active Directory account with permissions to create and manage App Registrations.
- A licensed Microsoft 365 mailbox to send email from.
Installation
- Install with Composer:
composer require madebythink/craft-microsoft-365-mail-transport
- In the Craft Control Panel, go to Settings > Plugins and install the "Microsoft 365 Mail Transport" plugin.
Azure App Registration Setup
You must create an App Registration in Azure AD to get the credentials this plugin needs.
- Log in to the Azure Portal.
- Navigate to Azure Active Directory.
- Go to App registrations and click + New registration.
- Give your application a Name (e.g., "Craft CMS Mailer").
- For Supported account types, select "Accounts in this organizational directory only (Single tenant)".
- Click Register.
Step 1: Get Tenant ID and Client ID
- On the Overview page for your new app registration, copy the Directory (tenant) ID and the Application (client) ID. You will need these for the plugin settings in Craft.
Step 2: Create a Client Secret
- In the app registration menu, go to Certificates & secrets.
- Click + New client secret.
- Give it a description (e.g., "Craft Plugin Secret") and choose an expiry duration.
- Click Add.
- IMMEDIATELY COPY THE "VALUE". This is your Client Secret. It will be hidden after you leave this page.
Step 3: Grant API Permissions
- In the app registration menu, go to API permissions.
- Click + Add a permission.
- Select Microsoft Graph.
- Select Application permissions. (Important: NOT "Delegated permissions").
- In the "Select permissions" search box, type
Mail.Sendand check the box next to Mail.Send. - Click Add permissions.
Step 4: Grant Admin Consent
- Because you added an Application permission, an administrator must grant consent.
- On the API permissions page, click the "Grant admin consent for [Your Directory Name]" button. The status for the
Mail.Sendpermission should change to "Granted".
Plugin Configuration
- In the Craft Control Panel, go to Settings > Email.
- For the Transport Type, select "Microsoft 365 (Graph API)".
- Fill in the settings fields with the values you copied from Azure:
- Tenant ID: Your Directory (tenant) ID.
- Client ID: Your Application (client) ID.
- Client Secret: The secret value you created.
- From Email Address: The email address of the licensed mailbox you want to send emails from (e.g.,
noreply@yourdomain.com).
- Save the settings and use the "Test" utility to send a test email.
It's highly recommended to store your credentials as environment variables in your .env file and reference them in the settings fields (e.g., $M365_CLIENT_ID).
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2026-07-06