Skip to content

boolean_smtp_should_log_email

Filters whether a message is written to the email log.

filter Tier A Since 1.0.0

Runs after the global logging setting has allowed the message, immediately before its log entry would be created. Return `false` to keep this message out of the log — a newsletter, a message with personal data, a high-volume transactional stream, or (as the add-on's plugin exclusions do) everything a given plugin sends. Not consulted for a queued message, a resend or a fallback retry: their log entry already exists and records the attempt.

Signature

add_filter( 'boolean_smtp_should_log_email', $callback, 10, 3 );

Parameters

ParameterTypeDescription
$logboolWhether to log the message. Default `true`.
$mail_dataarray<string, mixed>The message: `to`, `cc`, `bcc`, `from_email`, `from_name`, `subject`, `headers` (name => value) and `source` (the plugin or theme that sent it, when known).
$connection\BooleanSmtp\Models\Connection|nullThe connection the message is sent through, `null` when it is not known yet.

Returns bool — Whether to log the message.

Fires in

Example

boolean_smtp_should_log_email.php
add_filter( 'boolean_smtp_should_log_email', function ( bool $log, array $mail_data, ?\BooleanSmtp\Models\Connection $connection ) {
return $log;
}, 10, 3 );

Next steps