https://github.com/dotkernel/dot-mail-outlook
Microsoft Outlook ESMTP email service integration
https://github.com/dotkernel/dot-mail-outlook
Last synced: 5 months ago
JSON representation
Microsoft Outlook ESMTP email service integration
- Host: GitHub
- URL: https://github.com/dotkernel/dot-mail-outlook
- Owner: dotkernel
- License: mit
- Created: 2025-08-08T09:14:33.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2025-08-18T11:23:30.000Z (5 months ago)
- Last Synced: 2025-08-18T12:03:34.904Z (5 months ago)
- Language: PHP
- Homepage:
- Size: 9.77 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# dot-mail-outlook
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](https://github.com/dotkernel/dot-mail)
## Badges


[](https://github.com/dotkernel/dot-mail-outlook/issues)
[](https://github.com/dotkernel/dot-mail-outlook/network)
[](https://github.com/dotkernel/dot-mail-outlook/stargazers)
[](https://github.com/dotkernel/dot-mail-outlook/blob/0.1/LICENSE.md)
[](https://github.com/dotkernel/dot-mail-outlook/actions/workflows/continuous-integration.yml)
[](https://codecov.io/gh/dotkernel/dot-mail-outlook)
[](https://github.com/dotkernel/dot-mail/actions/workflows/static-analysis.yml)
## Installation
Install `dotkernel/dot-mail-outlook` by executing the following Composer command:
```shell
composer require dotkernel/dot-mail-outlook
```
Register `src/ConfigProvider.php` in `config/config.php` by adding the following line:
```php
\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
[
"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:
- `transport` **MUST** be set to under the `dot_mail.default.transport` key.
- `port` **MUST** be set to `587` under the `dot_mail.default.smtp_options.port` key.
- `tls` **MUST** be set to `STARTTLS` under the `dot_mail.default.smtp_options.tls` key.
- `host` **MUST** be one of `smtp-mail.outlook.com` or `smtp.office365.com` under the `dot_mail.default.smtp_options.host` key.
## Additional info
`dotkernel/dot-mail-outlook` makes use of SASL XOAUTH2 mechanism for use with the [SMTP AUTH](https://datatracker.ietf.org/doc/html/rfc4954) 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](https://learn.microsoft.com/en-us/exchange/client-developer/legacy-protocols/how-to-authenticate-an-imap-pop-smtp-application-by-using-oauth)
- [Microsoft identity platform and the OAuth 2.0 client credentials flow](https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-client-creds-grant-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.