bookmark_bordergform_after_email

Description

Use this hook to perform actions after a user or admin notification has been sent.

Usage

add_action( 'gform_after_email', 'after_email', 10, 12 );

Parameters

  • $is_success bool

    Indicates whether the wp_mail function was able to successfully process the mail request without errors.

  • $to string

    Email address to which the message is being sent

  • $subject string

    Email subject

  • $message string

    Email body

  • $headers array

    Email headers

  • $attachments array

    Email attachment(s)

  • $message_format string

    Email format: text or html

  • $from string

    From email

  • $from_name string

    From name

  • $bcc string

    Bcc email

  • $reply_to string

    Reply to email

  • $entry Entry Object

    The entry currently being processed or false if not available.

Examples

This example tries to send the email a second time if the original request were unsuccessful.

add_action( 'gform_after_email', 'after_email', 10, 7 );
function after_email( $is_success, $to, $subject, $message, $headers, $attachments, $message_format ) {
    if ( ! $is_success ) {
        //sending mail failed, try again one more time
        $try_again = wp_mail( $to, $subject, $message, $headers, $attachments );
        if ( ! $try_again ) {
            //still unable to send, do something...perhaps log the failure in a text file
        }
    }
}

Placement

This code should be placed in the functions.php file of your active theme.

Source Code

This action hook is located in GFCommon::send_email() in common.php