' : ''; } $smtp_on = !empty($config_smtp_provider); $imap_on = !empty($config_imap_provider); $oauth_needed = in_array($config_smtp_provider, ['google_oauth', 'microsoft_oauth'], true) || in_array($config_imap_provider, ['google_oauth', 'microsoft_oauth'], true); // ---- OAuth callback URI (for Entra App Registration) ------------------------ if (defined('BASE_URL') && !empty(BASE_URL)) { $mail_oauth_callback_uri = rtrim((string) BASE_URL, '/') . '/admin/oauth_microsoft_mail_callback.php'; } else { $mail_oauth_callback_uri = 'https://' . rtrim((string) $config_base_url, '/') . '/admin/oauth_microsoft_mail_callback.php'; } // ---- Readiness checks (drive the Tests tab) -------------------------------- $smtp_standard_ready = !empty($config_smtp_host) && !empty($config_smtp_port) && !empty($config_mail_from_email) && !empty($config_mail_from_name); $smtp_oauth_ready = in_array($config_smtp_provider, ['google_oauth', 'microsoft_oauth'], true) && !empty($config_mail_from_email) && !empty($config_mail_from_name) && !empty($config_mail_oauth_client_id) && !empty($config_mail_oauth_client_secret) && !empty($config_mail_oauth_refresh_token) && ($config_smtp_provider !== 'microsoft_oauth' || !empty($config_mail_oauth_tenant_id)); $imap_standard_ready = !empty($config_imap_username) && !empty($config_imap_password) && !empty($config_imap_host) && !empty($config_imap_port); $imap_oauth_ready = in_array($config_imap_provider, ['google_oauth', 'microsoft_oauth'], true) && !empty($config_imap_username) && !empty($config_mail_oauth_client_id) && !empty($config_mail_oauth_client_secret) && !empty($config_mail_oauth_refresh_token) && ($config_imap_provider !== 'microsoft_oauth' || !empty($config_mail_oauth_tenant_id)); $oauth_provider_for_test = ''; if (in_array($config_imap_provider, ['google_oauth', 'microsoft_oauth'], true)) { $oauth_provider_for_test = $config_imap_provider; } elseif (in_array($config_smtp_provider, ['google_oauth', 'microsoft_oauth'], true)) { $oauth_provider_for_test = $config_smtp_provider; } $oauth_has_required_fields = !empty($oauth_provider_for_test) && !empty($config_mail_oauth_client_id) && !empty($config_mail_oauth_client_secret) && !empty($config_mail_oauth_refresh_token) && ($oauth_provider_for_test !== 'microsoft_oauth' || !empty($config_mail_oauth_tenant_id)); $send_ready = $smtp_standard_ready || $smtp_oauth_ready; $imap_ready = $imap_standard_ready || $imap_oauth_ready; ?>

Mail Configuration

Choose your outbound mail provider.
Leave blank if no authentication is required.

Select your mailbox provider.
The mailbox address to monitor for incoming tickets.

These credentials are shared by any Sending or Receiving provider set to Google / Microsoft OAuth.
Expires at:

Each From address must be allowed to send on behalf of the SMTP user.

Purpose From Email From Name
System Default
share links, system tasks
Invoices
Quotes
Tickets
Finish configuring Sending, Receiving, or OAuth (plus at least one From address) to unlock the tests.
Send a Test Email
Test IMAP Connection
Test OAuth Token Refresh

Validates the refresh token and stores a new access token for .