gravitysmtp_connector_for_sending

Description

This gravitysmtp_connector_for_sending filter lets you dynamically choose which SMTP connector should handle a specific email.

Usage

add_filter( 'gravitysmtp_connector_for_sending', 'your_function_name', 10, 3 );

Parameters

ParameterTypeDescription
$current_typestringThe current connector type is being returned. Refer to Gravity SMTP Integration Slugs article for more information.
$email_dataarrayAn array of all the email data being used for this call.
$sourcestringThe source of the email.

Examples

Force a specific connector for certain emails.

add_filter( 'gravitysmtp_connector_for_sending', 'choose_connector', 10, 3 );
function choose_connector( $current_type, $email_data, $source ) {
    // do something
    return 'smtp';
}

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?

Since

This filter was added in Gravity SMTP version 1.2.

Source Code

This filter is located in includes/handler/class-mail-handler.php