# boolean_smtp_email_delivery_failed_final

> Fires when a mail delivery attempt has failed with no further fallback to try.

Action · Tier A · Since 1.0.0

The hook to build failure alerts on: unlike `boolean_smtp_email_failed`, which fires for every failed attempt, this fires once per message, after the fallback connection has also failed or been skipped, and not at all when `boolean_smtp_should_notify_delivery_failure` returned `false`.

## Signature

```php
add_action( 'boolean_smtp_email_delivery_failed_final', $callback, 10, 1 );
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `$data` | `array<string, mixed>` |  |
| &nbsp;&nbsp;`to` | `string` | Recipient address(es). |
| &nbsp;&nbsp;`subject` | `string` | Subject line. |
| &nbsp;&nbsp;`error` | `string` | Error message. |
| &nbsp;&nbsp;`code` | `int` | Numeric error code, `0` when the error carried none. |
| &nbsp;&nbsp;`log_id` | `int|null` | Id of the email log entry, `null` when no row was written. |
| &nbsp;&nbsp;`connection_id` | `int|null` | Id of the connection used, `null` when unknown. |
| &nbsp;&nbsp;`provider` | `string` | Provider of the connection used. |
| &nbsp;&nbsp;`source` | `string` | Code path that raised the failure: `wp_mail`, `api_queue`, `queue_exception`, …. |

## Fires in

- [app/Services/Mailer/EmailDeliveryFailureNotifier.php:96](https://github.com/booleanpress/boolean-smtp-src/blob/main/app/Services/Mailer/EmailDeliveryFailureNotifier.php#L96) — `BooleanSmtp\Services\Mailer\EmailDeliveryFailureNotifier::notifyFinal()`
- [app/Services/Mailer/EmailDeliveryFailureNotifier.php:139](https://github.com/booleanpress/boolean-smtp-src/blob/main/app/Services/Mailer/EmailDeliveryFailureNotifier.php#L139) — `BooleanSmtp\Services\Mailer\EmailDeliveryFailureNotifier::notifyFinalFromQueueLog()`

## Example

```php
add_action( 'boolean_smtp_email_delivery_failed_final', function ( array $data ) {
    // React to the event.
}, 10, 1 );
```
