groundhogg/email/send_failed

πŸ“… Published on

πŸ“ Last updated

Documentation

Β»

Action Hooks

Β»

groundhogg/email/send_failed

Fires when an email send attempt fails.

do_action( 'groundhogg/email/send_failed', $email );

You will receive the Email object.

Example

add_action( 'groundhogg/email/send_failed', 'my_extension_alert_on_failure' );

/**
 * Notify the primary owner when an email fails to send.
 *
 * @param \Groundhogg\Email $email
 *
 * @return void
 */
function my_extension_alert_on_failure( $email ) {
    $owner = \Groundhogg\get_primary_owner();

    if ( ! $owner ) {
        return;
    }

    \Groundhogg\gh_mail(
        $owner->user_email,
        '[Alert] Email send failed',
        sprintf( 'Failed to send "%s" (ID %d).', $email->get_title(), $email->get_id() )
    );
}

Was this helpful?

Let us know if this document answered your question. That’s the only way we can improve.