Skip to content

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

ParameterTypeDescription
$dataarray<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`).
$eventstringEvent type: `sent`, `failed` or `failed_final`.
$contextarray<string, mixed>Context for the event, keyed as listed above.

Returns array<string, mixed> — The filtered event data.

Fires in

Example

boolean_smtp_email_event_data.php
add_filter( 'boolean_smtp_email_event_data', function ( array $data, string $event, array $context ) {
return $data;
}, 10, 3 );

Next steps