Essential Configuration

After completing the Azure Configuration, you need to configure the TYPO3 extension with the values obtained from Microsoft Entra ID.

Quick Navigation

This page covers the complete configuration setup for the Exchange 365 TYPO3 extension:

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 LocalConfiguration.php file or through the TYPO3 Admin Panel if available. .. note:: The configuration variables are prefixed with TYPO3_CONF_VARS__MAIL__transport_exchange365_ to avoid conflicts with other mail transports.

  1. 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!
  2. 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!
  3. 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!
  4. 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!
  5. 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!
  6. 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!

Configuration Example

Here's a complete example of all required configuration variables:

TYPO3 configuration showing Exchange365 transport variables setup

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
Copied!

Alternative Configuration Methods

In Typo3 config files

Alternatively, you can add these settings directly to your TYPO3 configuration files, such as config/system/settings.php or config/system/additional.php or typo3conf/LocalConfiguration.php.

<?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...
];
Copied!

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;
Copied!

Testing the Configuration

After configuring all variables, you can test the email functionality by:

  1. Sending a test email through TYPO3's mail functionality
  2. Checking the TYPO3 logs for any error messages
  3. Verifying that emails are received at the intended recipients
  4. Checking the sender's "Sent Items" folder if saveToSentItems is enabled

Security Considerations

Configuration Validation

To verify your configuration is correct:

  1. 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
    TYPO3 Admin Panel showing mail transport configuration
  2. Check TYPO3 configuration:

    // In TYPO3 backend or debug context
    \TYPO3\CMS\Core\Utility\DebugUtility::debug($GLOBALS['TYPO3_CONF_VARS']['MAIL']);
    Copied!
  3. 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!
  4. Check logs: Monitor TYPO3 logs for authentication or sending errors