Campaigns and A/B testing
Campaign statuses
| Status | Meaning |
|---|---|
draft | Not yet scheduled |
scheduled | Will send at scheduled_at |
sending | Active batch send in progress |
sent | Completed |
paused | Paused mid-send |
Send modes
| Mode | Behaviour |
|---|---|
immediate | Batches sent on save-and-send |
scheduled | Sends at scheduled_at datetime |
smart | Sends to each subscriber at their optimal_send_hour |
Smart-mode requires at least 3 historical opens per subscriber (calculated weekly by om_recalculate_send_times).
Creating a campaign in PHP
php$id = OM_Campaign::create([
'subject' => 'Your July Newsletter',
'preview_text' => 'Inside: summer updates',
'from_name' => 'Jane',
'from_email' => 'jane@acme.com',
'html_content' => '<h1>Hello {{first_name}}</h1>...',
'list_id' => 3,
'send_mode' => 'immediate',
]);
OM_Campaign::schedule( $id, '2026-08-01 09:00:00' );
OM_Campaign::pause( $id );
$stats = OM_Campaign::get_stats( $id );A/B split testing
OM_ABTest runs subject, content, or sender-name variants against a parent (control) campaign.
- Create the parent campaign (becomes control).
- Create one or more variants with different subject lines or HTML.
- On send, OMailer splits the list by
ab_split_pctper variant. - After
ab_eval_hours,OM_ABTest::evaluate()scores by open rate or click rate and marks the winner. - The winner is sent to all remaining subscribers.
php$ab = new OM_ABTest();
$variant_id = $ab->create_variant( $parent_id, [
'subject' => 'Different subject line',
'html_content' => '<p>Variant B...</p>',
], 30, 'open_rate', 24 );Evaluation runs hourly via om_evaluate_ab_tests cron.

