Skip to content

Mail pipeline

Every message that goes through wp_mail() passes these hooks, in the order they fire: intake, validation, header normalization, connection resolution, the PHPMailer hand-off, transport, the send result.

HookKindTierSinceSummary
boolean_smtp_before_sendactionA1.0.0Fires immediately before a message is sent, after the connection and transport have been configured.
boolean_smtp_email_headersfilterA1.0.0Filters the custom headers collected from PHPMailer before the message is logged.
boolean_smtp_mail_after_validateactionA1.0.0Fires after a message has passed validation, before headers are normalized.
boolean_smtp_mail_attempt_recordedactionB1.0.0Fires after a send attempt has been recorded in the email log.
boolean_smtp_mail_before_logactionB1.0.0Fires before an outgoing message is offered to the email log.
boolean_smtp_mail_before_phpmaileractionA1.0.0Fires after PHPMailer has been built from the message, before phpmailer_init runs.
boolean_smtp_mail_connection_resolvedactionA1.0.0Fires after a connection has been resolved for an outgoing message, before it is applied to PHPMailer.
boolean_smtp_mail_fallbackactionA1.0.0Fires before a failed send is retried through the fallback connection.
boolean_smtp_mail_headersfilterA1.0.0Filters the header bag built from the message before normalization.
boolean_smtp_mail_headers_normalizedactionB1.0.0Fires after headers have been normalized, before they are written back onto the message.
boolean_smtp_mail_intakeactionA1.0.0Fires when a message enters the BooleanSMTP mail pipeline, before validation runs.
boolean_smtp_mail_send_resultactionA1.0.0Fires after a send attempt has completed, whether it succeeded or failed.
boolean_smtp_mail_transport_sendactionB1.0.0Fires immediately before the message is handed to PHPMailer's transport.
boolean_smtp_mail_validatefilterA1.0.0Filters whether a message should be rejected before it is processed further.
boolean_smtp_mailer_resolvedactionB1.0.0Fires after the mailer has been fully configured for a send, with diagnostic details about the resolved connection and transport.
boolean_smtp_max_retry_attemptsfilterA1.0.0Filters how many times a failed message is retried on other connections.
boolean_smtp_message_bodyfilterA1.0.0Filters the message body immediately before it is sent.
boolean_smtp_plain_text_bodyfilterA1.0.0Filters the automatically generated plain-text alternative body.
boolean_smtp_queue_should_enqueuefilterA1.0.0Filters whether a message is queued for background delivery instead of being sent now.
boolean_smtp_resolve_connectionfilterA1.0.0Filters the connection resolved for an outgoing message, after routing rules and sender matching have run.
boolean_smtp_resolve_routing_rule_connectionfilterA1.0.0Filters the connection a routing rule resolves for an outgoing message.
boolean_smtp_should_log_emailfilterA1.0.0Filters whether a message is written to the email log.
boolean_smtp_skip_fallback_retryfilterA1.0.0Filters whether the fallback retry should be skipped for a failed send.
boolean_smtp_transportsfilterA1.0.0Filters the map of registered transport drivers.