# boolean_smtp_mail_validate

> Filters whether a message should be rejected before it is processed further.

Filter · Tier A · Since 1.0.0

Return an error object (see {@see \BooleanSmtp\Adapters\Contracts\ErrorHandlerAdapterContract}) to reject the message and fail the send; return null to let it continue.

## Signature

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

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `$validation` | `mixed` | Null to continue, or an error object naming the rejection reason. |
| `$atts` | `array<string, mixed>` | wp_mail-style arguments being validated. |

**Returns** `mixed` — A `WP_Error` to reject the message, `true` to accept it, or `null` to run the built-in validation.

## Fires in

- [app/Services/Mailer/BooleanSmtpMailPipeline.php:91](https://github.com/booleanpress/boolean-smtp-src/blob/main/app/Services/Mailer/BooleanSmtpMailPipeline.php#L91) — `BooleanSmtp\Services\Mailer\BooleanSmtpMailPipeline::send()`

## Example

```php
add_filter( 'boolean_smtp_mail_validate', function ( $validation, array $atts ) {
    return $validation;
}, 10, 2 );
```
