# boolean_smtp_max_retry_attempts

> Filters how many times a failed message is retried on other connections.

Filter · Tier A · Since 1.0.0

Applies when "Retry on other connections" is on: after the first failed send the queue worker retries the message on the active connections it has not tried yet, one per attempt, up to this many times. The add-on's "Maximum Attempts" setting is delivered through this filter. Return `0` to disable retries without turning the setting off.

## Signature

```php
add_filter( 'boolean_smtp_max_retry_attempts', $callback, 10, 1 );
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `$attempts` | `int` | Retries after the first failed send. Default `2`. |

**Returns** `int` — Retries after the first failed send.

## Fires in

- [app/Services/Queue/RetryLadder.php:108](https://github.com/booleanpress/boolean-smtp-src/blob/main/app/Services/Queue/RetryLadder.php#L108) — `BooleanSmtp\Services\Queue\RetryLadder::limit()`

## Example

```php
add_filter( 'boolean_smtp_max_retry_attempts', function ( int $attempts ) {
    return $attempts;
}, 10, 1 );
```
