Description
The gravitysmtp_abort_email_suppression
filter prevents developers from adding an email to the suppression list. Note that this filter does not change suppression of messages being sent to addresses which exist on the suppression list.
Usage
add_filter( 'gravitysmtp_abort_email_suppression', 'your_function_name', 10, 4 );
Parameters
Parameter | Type | Description |
---|---|---|
$skip | bool | Whether to skip suppressing the email. Default is false |
string | The email address to be suppressed. | |
$reason | string | The reason for suppression. |
$notes | string | Additional notes about the suppression. |
Examples
Prevent suppression of email addresses belonging to site administrators.
add_filter( 'gravitysmtp_abort_email_suppression', function( $skip, $email, $reason, $notes ) {
// Disallow suppression of email address belonging to any administrator
$admin_users = get_users( array( 'role' => 'administrator' ) );
foreach ( $admin_users as $admin ) {
if ( $email === $admin->user_email ) {
return true;
}
}
return $skip;
}, 10, 4 );
Placement
This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.
See also the PHP section in this article: Where Do I Put This Code?
Source Code
This filter is located in Suppressed_Emails_Model::suppress_email() in class-suppressed-emails-model.php
Since
This filter was added in Gravity SMTP version 1.5.1