Skip to content

Action & Filter Hooks

MailFuz adheres to strict WordPress hook hygiene. You can modify payloads, inject custom headers, and listen for delivery events.

Fires immediately before dispatching via the active transport.

add_action( 'mailfuz_before_send', function( $message, $transport ) {
// Access $message->get_to(), $message->get_subject()
}, 10, 2 );

Fires after a message has been processed by the delivery transport.

add_action( 'mailfuz_after_send', function( $result, $message, $transport ) {
if ( $result->is_success() ) {
// Log custom analytical event
}
}, 10, 3 );

Fires when the primary transport fails and the standby backup is engaged.

add_action( 'mailfuz_failover_triggered', function( $primary_id, $backup_id, $error_msg ) {
// Send Slack alert or PagerDuty incident
}, 10, 3 );

Modify the outgoing message object before it is passed to the transport.

add_filter( 'mailfuz_message_payload', function( $message ) {
$message->add_header( 'X-Custom-Tenant-ID', 'tenant_8482' );
return $message;
} );

MailFuz registers native WP-CLI commands for command-line queue processing:

Terminal window
# Process next 50 pending queue messages
wp mailfuz queue process --limit=50
# Inspect queue status
wp mailfuz queue status
# Flush failed queue jobs
wp mailfuz queue retry-failed