# boolean_smtp_mail_before_log

> Fires before an outgoing message is offered to the email log.

Action · Tier B · Since 1.0.0

The message may still be kept out of the log by the source exclusions or by `boolean_smtp_should_log_email`; `boolean_smtp_mail_attempt_recorded` fires only when a row was written.

## Signature

```php
add_action( 'boolean_smtp_mail_before_log', $callback, 10, 2 );
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `$phpmailer` | `\PHPMailer\PHPMailer\PHPMailer` | Mailer instance about to be logged. |
| `$connection` | `\BooleanSmtp\Models\Connection` | Connection the message is being sent through. |

## Fires in

- [app/Services/Mailer/MailerManager.php:336](https://github.com/booleanpress/boolean-smtp-src/blob/main/app/Services/Mailer/MailerManager.php#L336) — `BooleanSmtp\Services\Mailer\MailerManager::configure()`

## Example

```php
add_action( 'boolean_smtp_mail_before_log', function ( \PHPMailer\PHPMailer\PHPMailer $phpmailer, \BooleanSmtp\Models\Connection $connection ) {
    // React to the event.
}, 10, 2 );
```
