boolean_smtp_email_event_data
Filters the data describing a mail delivery event before it is announced and used to build a notification.
filter Tier A Since 1.0.0
Fired immediately before `boolean_smtp_email_sent`, `boolean_smtp_email_failed` and `boolean_smtp_email_delivery_failed_final`; the array returned here is what those actions receive. `$context` carries the same keys for a given event wherever it is fired (a key is `null` when its value is unknown): - `sent`: `log` (the `EmailLog`), `mail_data` (the `wp_mail()` arguments, empty for a queued send). - `failed`: `log` (the `EmailLog`), `wp_error` (the `WP_Error` of the attempt). - `failed_final`: `log` (the `EmailLog`, `null` when no row was written), `wp_error` (`null` when the failure was raised outside `wp_mail_failed`), `source` (the code path: `wp_mail`, `api_queue`, `queue_exception`, …).
Signature
add_filter( 'boolean_smtp_email_event_data', $callback, 10, 3 );Parameters
| Parameter | Type | Description |
|---|---|---|
$data | array<string, mixed> | Event data. `sent`: `id`, `to`, `subject`, `status`, `provider`, `timestamp`, `log_id`, `connection_id`. `failed` and `failed_final`: `to`, `subject`, `error`, `code`, `log_id`, `connection_id`, `provider` (and `source` for `failed_final`). |
$event | string | Event type: `sent`, `failed` or `failed_final`. |
$context | array<string, mixed> | Context for the event, keyed as listed above. |
Returns array<string, mixed> — The filtered event data.
Fires in
app/Jobs/ProcessQueueJob.php:283—BooleanSmtp\Jobs\ProcessQueueJob::handle()app/Services/Mailer/EmailDeliveryFailureNotifier.php:56—BooleanSmtp\Services\Mailer\EmailDeliveryFailureNotifier::notifyFinal()app/Services/Mailer/EmailDeliveryFailureNotifier.php:130—BooleanSmtp\Services\Mailer\EmailDeliveryFailureNotifier::notifyFinalFromQueueLog()app/Services/Mailer/EmailLogSendLifecycle.php:134—BooleanSmtp\Services\Mailer\EmailLogSendLifecycle::onWpMailSucceeded()app/Services/Mailer/EmailLogSendLifecycle.php:226—BooleanSmtp\Services\Mailer\EmailLogSendLifecycle::onWpMailFailed()
Example
add_filter( 'boolean_smtp_email_event_data', function ( array $data, string $event, array $context ) { return $data;}, 10, 3 );Next steps
- Delivery lifecycle — every hook in this area, in firing order where that applies.
- Hook Explorer — filter and search every hook.