Action & Filter Hooks
MailFuz adheres to strict WordPress hook hygiene. You can modify payloads, inject custom headers, and listen for delivery events.
Action Hooks
Section titled “Action Hooks”mailfuz_before_send
Section titled “mailfuz_before_send”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 );mailfuz_after_send
Section titled “mailfuz_after_send”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 );mailfuz_failover_triggered
Section titled “mailfuz_failover_triggered”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 );Filter Hooks
Section titled “Filter Hooks”mailfuz_message_payload
Section titled “mailfuz_message_payload”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;} );WP-CLI Commands
Section titled “WP-CLI Commands”MailFuz registers native WP-CLI commands for command-line queue processing:
# Process next 50 pending queue messageswp mailfuz queue process --limit=50
# Inspect queue statuswp mailfuz queue status
# Flush failed queue jobswp mailfuz queue retry-failed