dotkernel / dot-mail-outlook
Dotkernel Dot-Mail Outlook ESMTP service.
Installs: 308
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 0
Forks: 0
Open Issues: 1
pkg:composer/dotkernel/dot-mail-outlook
Requires
- php: ~8.2.0 || ~8.3.0 || ~8.4.0
- ext-curl: *
- dotkernel/dot-dependency-injection: ^1.2.0
- dotkernel/dot-mail: ^5.1.5
- laminas/laminas-servicemanager: ^3.22 || ^4.0
- symfony/mailer: ^v7.1.6
Requires (Dev)
- laminas/laminas-coding-standard: ^3.1.0
- phpstan/phpstan: ^2.1
- phpstan/phpstan-phpunit: ^2.0
- phpunit/phpunit: ^10.5.46
This package is auto-updated.
Last update: 2025-10-19 11:07:36 UTC
README
Dotkernel's Microsoft Outlook ESMTP email service, implementing the client credentials grant_type.
dot-mail-outlook is a wrapper on top of dotkernel/dot-mail
Badges
Installation
Install dotkernel/dot-mail-outlook by executing the following Composer command:
composer require dotkernel/dot-mail-outlook
Register src/ConfigProvider.php in config/config.php by adding the following line:
\Dot\MailOutlook\ConfigProvider::class,
Configuration
Copy the dot-mail-outlook.local file to your autoload folder (or copy its contents to mail.global.php) and fill in the relevant information.
<?php declare(strict_types=1); $tenant = ''; return [ 'xoauth2_outlook' => [ "tokenCacheFile" => '', "tenant" => $tenant, "access_code_url" => "https://login.microsoftonline.com/{$tenant}/oauth2/v2.0/token", "client_id" => '', "client_secret" => '', "scope" => 'https://outlook.office.com/.default', "grant_type" => 'client_credentials', ], ];
The dotkernel/dot-mail config file should be updated to make sure the necessary options are set:
transportMUST be set to under thedot_mail.default.transportkey.portMUST be set to587under thedot_mail.default.smtp_options.portkey.tlsMUST be set toSTARTTLSunder thedot_mail.default.smtp_options.tlskey.hostMUST be one ofsmtp-mail.outlook.comorsmtp.office365.comunder thedot_mail.default.smtp_options.hostkey.
Additional info
dotkernel/dot-mail-outlook makes use of SASL XOAUTH2 mechanism for use with the SMTP AUTH command.
To allow generating the bearer token in the background, without user input required,
dot-mail-outlook implements the client credentials flow from Microsoft:
- Authenticate an IMAP, POP or SMTP connection using OAuth
- Microsoft identity platform and the OAuth 2.0 client credentials flow
Make sure to set all relevant permissions, give relevant tenant administrator consent and register the necessary service principals, as described in Microsoft's flow.