Frontend Configuration

The Exchange 365 Mailer extension supports frontend email sending through popular TYPO3 extensions like Powermail, Form Framework, and other form extensions. This requires additional TypoScript configuration to work properly.

Frontend Configuration Overview

Frontend email sending requires the same 5 core parameters as the backend configuration, but they must be configured via TypoScript instead of environment variables or LocalConfiguration.php.

TYPO3 TypoScript configuration showing Exchange365 frontend parameters

Required TypoScript Parameters

The following 5 parameters must be configured in your TypoScript setup for frontend email functionality:

  1. Transport Class Configuration

    Set the mail transport to use the Exchange365Transport class for frontend operations.

    config.mail.transport = OliverKroener\OkExchange365\Mail\Transport\Exchange365Transport
    Copied!
  2. Tenant ID

    Configure your Microsoft Entra ID tenant identifier.

    plugin.tx_okexchange365mailer.settings.exchange365.tenantId = your-tenant-id-here
    Copied!
  3. Client ID

    Set your Azure application's client identifier.

    plugin.tx_okexchange365mailer.settings.exchange365.clientId = your-client-id-here
    Copied!
  4. Client Secret

    Configure the Azure application's client secret.

    plugin.tx_okexchange365mailer.settings.exchange365.clientSecret = your-client-secret-here
    Copied!
  5. From Email Address

    Set the sender email address for frontend-generated emails.

    plugin.tx_okexchange365mailer.settings.exchange365.fromEmail = service@your-domain.com
    Copied!
  6. Save to Sent Items (Optional)

    Determine whether frontend emails should be saved to the sender's "Sent Items" folder.

    plugin.tx_okexchange365mailer.settings.exchange365.saveToSentItems = 1
    Copied!

Complete TypoScript Configuration Example

Here's a complete TypoScript setup example for frontend email functionality:

# Exchange 365 Frontend Mail Configuration
config {
    mail {
        # Set transport to Exchange 365
        transport = OliverKroener\OkExchange365\Mail\Transport\Exchange365Transport
        
        # Optional: Default mail settings
        defaultMailFromAddress = service@your-domain.com
        defaultMailFromName = Your Organization Name
    }
}

# Exchange 365 specific configuration
plugin.tx_okexchange365mailer {
    settings {
        exchange365 {
            # Azure/Microsoft Entra ID Configuration
            tenantId = your-tenant-id-here
            clientId = your-client-id-here
            clientSecret = your-client-secret-here
            
            # Email Configuration
            fromEmail = service@your-domain.com
            saveToSentItems = 1
        }
    }
}
Copied!

Integration with Form Extensions

Powermail Integration

When using Powermail, the extension will automatically use the configured Exchange 365 transport for sending emails:

plugin.tx_powermail {
    settings {
        setup {
            # Powermail will use the global mail configuration
            # No additional configuration needed
        }
    }
}
Copied!

TYPO3 Form Framework Integration

For the TYPO3 Form Framework, ensure your form configuration references the global mail settings:

# In your form configuration (YAML)
finishers:
  -
    identifier: EmailToReceiver
    options:
      # Uses global mail configuration automatically
      recipientAddress: 'recipient@example.com'
      recipientName: 'Recipient Name'
Copied!

Configuration File Locations

Place your TypoScript configuration in one of these locations:

Template Records
Add the configuration to your main TypoScript template record in the TYPO3 backend.
Static Files

Create or modify files in your site package:

  • Configuration/TypoScript/setup.typoscript
  • Configuration/TypoScript/constants.typoscript (for constants)
Page TSconfig (Not recommended for mail settings)
Only use for page-specific overrides, not for global mail configuration.

Security Considerations for Frontend

Best Practices

  1. Environment-Specific Configuration

    Use different Azure applications for different environments:

    [applicationContext == "Development"]
        plugin.tx_okexchange365mailer.settings.exchange365.clientId = dev-client-id
        plugin.tx_okexchange365mailer.settings.exchange365.tenantId = dev-tenant-id
    [END]
    
    [applicationContext == "Production"]
        plugin.tx_okexchange365mailer.settings.exchange365.clientId = prod-client-id
        plugin.tx_okexchange365mailer.settings.exchange365.tenantId = prod-tenant-id
    [END]
    Copied!
  2. Conditional Loading

    Only load Exchange 365 configuration when needed:

    [siteIdentifier == "main-site"]
        <INCLUDE_TYPOSCRIPT: source="FILE:EXT:site_package/Configuration/TypoScript/exchange365.typoscript">
    [END]
    Copied!
  3. Fallback Configuration

    Always provide fallback settings:

    config.mail {
        defaultMailFromAddress = fallback@your-domain.com
        defaultMailFromName = Fallback Sender
    }
    Copied!

Testing Frontend Configuration

To test your frontend configuration:

  1. Create a test form using Powermail or Form Framework
  2. Submit the form and verify email delivery
  3. Check TYPO3 logs for any authentication or sending errors
  4. Verify in Exchange 365 that emails appear in the sender's mailbox (if saveToSentItems is enabled)

Troubleshooting Frontend Issues

Common issues and solutions:

Emails not sending
  • Verify all 5 parameters are correctly configured in TypoScript
  • Check that the Azure application has proper permissions
  • Ensure the sender email exists in Exchange 365
Authentication errors
  • Verify Tenant ID and Client ID are correct
  • Check that the Client Secret is valid and not expired
  • Confirm Azure admin consent has been granted
Permission errors
  • Ensure the Azure application has Mail.Send permission
  • Verify the sender email address exists in your Exchange 365 environment
  • Check that the application can send on behalf of the specified user