groundhogg/email/after_send

πŸ“… Published on

πŸ“ Last updated

Documentation

Β»

Action Hooks

Β»

groundhogg/email/after_send

Fires after an Email object has finished its send attempt, whether it succeeded or failed.

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

You will receive the Email object.

Example

add_action( 'groundhogg/email/after_send', 'my_extension_record_send' );

/**
 * Record every email send in a custom analytics table.
 *
 * @param \Groundhogg\Email $email
 *
 * @return void
 */
function my_extension_record_send( $email ) {
    $contact = $email->get_contact();

    my_extension_log_send( [
        'email_id'   => $email->get_id(),
        'contact_id' => $contact ? $contact->get_id() : 0,
        'subject'    => $email->get_subject_line(),
        'sent_at'    => current_time( 'mysql' ),
    ] );
}

Was this helpful?

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