# 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

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

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `$enqueue` | `bool` | Whether to queue the message. Default `false`. |
| `$atts` | `array<string, mixed>` | The `wp_mail()` arguments: `to`, `subject`, `message`, `headers`, `attachments`, and `embeds` when given. |

**Returns** `bool` — Whether to queue the message.

## Fires in

- [app/Support/BooleanSmtpWpMail.php:148](https://github.com/booleanpress/boolean-smtp-src/blob/main/app/Support/BooleanSmtpWpMail.php#L148) — `BooleanSmtp\Support\BooleanSmtpWpMail::shouldEnqueue()`

## Example

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