Essential Configuration
After completing the Azure Configuration, you need to configure the TYPO3 extension with the values obtained from Microsoft Entra ID.
Attention
The Client ID can be found on the overview page in Azure and should not be confused with the Client Secret ID. For the secret configuration, only the Secret value itself is required, not the Secret ID.
Configuration Variables
The extension requires several configuration variables to be set in TYPO3. These can be configured through environment variables or directly in the TYPO3 configuration.
The following steps show the configuration with .env variables, but you can also set them in the Local
file or through the TYPO3 Admin Panel if available.
.. note::
The configuration variables are prefixed with TYPO3_
to avoid conflicts with other mail transports.
-
Set the mail transport to Exchange365Transport.
Configure TYPO3 to use the Exchange 365 transport instead of the default SMTP transport.
TYPO3_CONF_VARS__MAIL__transport=OliverKroener\\OkExchange365\\Mail\\Transport\\Exchange365Transport
Copied! -
Configure the Tenant ID.
Set the Tenant ID obtained from step 4 of the Azure Configuration.
TYPO3_CONF_VARS__MAIL__transport_exchange365_tenantId='your-tenant-id-here'
Copied!Attention
Replace
your-
with the actual Tenant ID from your Azure application overview page.tenant- id- here -
Configure the Client ID.
Set the Client ID (Application ID) obtained from step 4 of the Azure Configuration.
TYPO3_CONF_VARS__MAIL__transport_exchange365_clientId='your-client-id-here'
Copied!Attention
Replace
your-
with the actual Client ID from your Azure application overview page.client- id- here -
Configure the Client Secret.
Set the Client Secret value obtained from step 7 of the Azure Configuration.
TYPO3_CONF_VARS__MAIL__transport_exchange365_clientSecret='your-client-secret-here'
Copied!Attention
- Replace
your-
with the actual Secret Value (not the Secret ID)client- secret- here - This is sensitive information - keep it secure and never expose it in public repositories
- Replace
-
Configure the sender email address.
Set the email address that will be used as the sender for all emails sent through this transport.
TYPO3_CONF_VARS__MAIL__transport_exchange365_fromEmail='service@your-domain.com'
Copied!Attention
The email address will fall back to TYPO3's
$GLOBALS
if not specified here.['TYPO3_ CONF_ VARS'] ['MAIL'] ['default Mail From Address'] Note
- Replace
service@your-
with a valid email address from your organization (it must exist in your Exchange 365 environment as SharedMailbox or User Mailbox)domain. com - This email address must exist in your Exchange 365 environment
- The application needs permission to send emails on behalf of this address
- Replace
-
Configure save to sent items (optional).
Determine whether sent emails should be saved to the sender's "Sent Items" folder.
TYPO3_CONF_VARS__MAIL__transport_exchange365_saveToSentItems=1
Copied!Note
- Set to
1
to save emails to Sent Items folder - Set to
0
to skip saving emails to Sent Items folder - Default value is
0
(enabled) if not specified
- Set to
Configuration Example
Here's a complete example of all required configuration variables:

Environment Variables (.env file)
You can configure these settings using a .env
file in your TYPO3 root directory:
# Exchange 365 Mail Transport Configuration
TYPO3_CONF_VARS__MAIL__transport=OliverKroener\\OkExchange365\\Mail\\Transport\\Exchange365Transport
TYPO3_CONF_VARS__MAIL__transport_exchange365_tenantId='your-tenant-id-here'
TYPO3_CONF_VARS__MAIL__transport_exchange365_clientId='your-client-id-here'
TYPO3_CONF_VARS__MAIL__transport_exchange365_clientSecret='your-client-secret-here'
TYPO3_CONF_VARS__MAIL__transport_exchange365_fromEmail='service@your-domain.com'
TYPO3_CONF_VARS__MAIL__transport_exchange365_saveToSentItems=1
Alternative Configuration Methods
In Typo3 config files
Alternatively, you can add these settings directly to your TYPO3 configuration files, such as config/
or typo3conf/
.
<?php
return [
// ...existing configuration...
'MAIL' => [
'transport' => 'OliverKroener\\OkExchange365\\Mail\\Transport\\Exchange365Transport',
'transport_exchange365_tenantId' => 'your-tenant-id-here',
'transport_exchange365_clientId' => 'your-client-id-here',
'transport_exchange365_clientSecret' => 'your-client-secret-here',
'transport_exchange365_fromEmail' => 'service@your-domain.com',
'transport_exchange365_saveToSentItems' => 1,
],
// ...existing configuration...
];
Or using the $GLOBALS syntax:
<?php
// In typo3conf/LocalConfiguration.php or ext_localconf.php
$GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport'] = 'OliverKroener\\OkExchange365\\Mail\\Transport\\Exchange365Transport';
$GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport_exchange365_tenantId'] = 'your-tenant-id-here';
$GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport_exchange365_clientId'] = 'your-client-id-here';
$GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport_exchange365_clientSecret'] = 'your-client-secret-here';
$GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport_exchange365_fromEmail'] = 'service@your-domain.com';
$GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport_exchange365_saveToSentItems'] = 1;
Attention
- Replace placeholder values with your actual Azure configuration values
- When using PHP syntax, use single backslashes (``) in class names instead of double backslashes
- Keep the client secret secure and never commit it to version control
Testing the Configuration
After configuring all variables, you can test the email functionality by:
- Sending a test email through TYPO3's mail functionality
- Checking the TYPO3 logs for any error messages
- Verifying that emails are received at the intended recipients
- Checking the sender's "Sent Items" folder if
save
is enabledTo Sent Items
Tip
Enable TYPO3's developer log to see detailed information about the email sending process and any potential issues with the Exchange 365 integration.
Security Considerations
Warning
Azure Credential Security
- Store the
client
securely using environment variables or encrypted configurationSecret - Never commit secrets to version control systems
- Rotate client secrets regularly before expiration
- Use different Azure applications for different environments (dev/staging/prod)
- Monitor Azure sign-in logs for unauthorized access
Configuration Validation
To verify your configuration is correct:
-
Check in backend:
- Navigate to the TYPO3 Admin Panel
- Check the mail configuration under Settings > Environment > Test Mail Setup
- Ensure the transport is set to
Exchange365Transport
and all required fields are filled
-
Check TYPO3 configuration:
// In TYPO3 backend or debug context \TYPO3\CMS\Core\Utility\DebugUtility::debug($GLOBALS['TYPO3_CONF_VARS']['MAIL']);
Copied! -
Test email sending:
// Test email functionality $mail = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Mail\MailMessage::class); $mail->to('test@example.com') ->subject('Test Email') ->text('This is a test email from TYPO3.') ->send();
Copied! - Check logs: Monitor TYPO3 logs for authentication or sending errors