Abuja Digital Studio · Est. 2018
Start a Project
DocsOMailerSMTP and smart routing
Reference

SMTP and smart routing

OMailerorravo.com/docs/omailer/smtp-routing

SMTP and smart routing

OM_SMTP manages every outbound connection. Multiple connections are supported with a primary and an optional backup.

Supported providers

ProviderHostPortEncryption
Gmail / Google Workspacesmtp.gmail.com587TLS
Microsoft 365 / Outlooksmtp.office365.com587TLS
Amazon SESregion-specific587TLS
Zoho Mailsmtp.zoho.com587TLS
CustomconfigurableconfigurableTLS or SSL

Gmail requires an App Password (2FA must be on). Microsoft 365 needs SMTP AUTH enabled per mailbox in Exchange Admin Center. Amazon SES requires SMTP credentials from IAM, not regular access keys, and production access must be requested to leave the sandbox.

Connection structure

Connections live in the om_smtp_connections option (array, passwords encrypted). Routing lives in om_smtp_routing:

php[ 'primary' => 'conn_id', 'backup' => 'conn_id' ]

Failover via OM_Smart_Routing

  1. Every send uses the primary connection.
  2. On failure (wp_mail_failed hook), OMailer switches to the backup for the rest of the batch.
  3. After the batch completes, the primary is reinstated.

PHP API

php$smtp = new OM_SMTP();
$connections = $smtp->get_connections();
$smtp->save_connection( 'conn_id', $data );
$primary_id = $smtp->get_primary_id();
$result = $smtp->send_test( 'conn_id', 'recipient@example.com' );

Hooks

php// Fired when failover activates
add_action( 'om_smtp_failover', function( string $failed_id, string $backup_id ) {}, 10, 2 );

// Filter to override connection per send
add_filter( 'om_resolve_smtp_connection', function( string $id, array $mail ) {
    return $id;
}, 10, 2 );
SMTP and smart routing · OMailer Docs | Orravo