Skip to content

boolean_smtp_queue_should_enqueue

Filters whether a message is queued for background delivery instead of being sent now.

filter Tier A Since 1.0.0

Consulted for every `wp_mail()` / `boolean_smtp_mail()` call. Return `true` to store the message and let the queue worker send it — bulk or newsletter mail, for example — while transactional mail keeps going out immediately. A queued call returns `true` to its caller as soon as the message is stored; the worker runs from WP-Cron within a minute (or at once with `wp boolean-smtp queue:work`).

Signature

add_filter( 'boolean_smtp_queue_should_enqueue', $callback, 10, 2 );

Parameters

ParameterTypeDescription
$enqueueboolWhether to queue the message. Default `false`.
$attsarray<string, mixed>The `wp_mail()` arguments: `to`, `subject`, `message`, `headers`, `attachments`, and `embeds` when given.

Returns bool — Whether to queue the message.

Fires in

Example

boolean_smtp_queue_should_enqueue.php
add_filter( 'boolean_smtp_queue_should_enqueue', function ( bool $enqueue, array $atts ) {
return $enqueue;
}, 10, 2 );

Next steps