gravitysmtp_on_primary_failure

Description

Fires when an email fails to send through the primary SMTP server in Gravity SMTP. The gravitysmtp_on_primary_failure action lets you run custom code when the primary mail sending attempt fails.

Usage

add_action( 'gravitysmtp_on_primary_failure', 'your_function_name', 10, 1 );

Parameters

ParameterTypeDescription
$failed_idintThe ID of the failed email event.

Examples

Perform a custom action when the primary email send fails.

add_action( 'gravitysmtp_on_primary_failure', function( $failed_id ) {
  // Do something when primary sending fails from Gravity 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?

Source Code

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

Since

This action was added in Gravity SMTP 2.2