Jooosi Mail works with WordPress’s existing wp_mail() flow. When mail interception is enabled, WordPress plugins and themes can keep calling wp_mail(); Jooosi Mail normalizes the message and sends it through the configured delivery mode and routing strategy.
Use WordPress mail#
Use the standard WordPress function for ordinary application mail:
wp_mail(
'[email protected]',
'Your order has shipped',
'Your order is on its way.'
);
Use the normal WordPress filter for content type, attachments, and headers. Jooosi Mail converts those arguments to a MailRequest.
Customize a normalized request#
The f!jooosi-mail/mail:normalize.request filter receives the normalized request, original wp_mail() arguments, and normalized headers. Return a MailRequest. Use its immutable with() method to change selected fields:
use JooosiMail\Mail\ValueObject\MailRequest;
add_filter(
'f!jooosi-mail/mail:normalize.request',
static function (MailRequest $request, array $args, array $headers): MailRequest {
if (($args['subject'] ?? '') === 'Your order has shipped') {
return $request->with(['subject' => 'Shipping update']);
}
return $request;
},
10,
3,
);
Observe delivery events#
Use actions to observe message lifecycle events. a!jooosi-mail/mail:queued fires after a message is durably queued and receives the mail-log ID and queue name. a!jooosi-mail/mail:sent receives the mail-log ID, connection ID, and optional provider message ID. a!jooosi-mail/mail:failed receives the mail-log ID and failure message.
Filters and actions follow WordPress hook conventions. Keep callbacks quick, return a valid MailRequest from filters, and avoid sending a second copy from lifecycle observers.
Versioned REST routes#
Jooosi Mail registers its REST API in the jooosi-mail/v1 namespace. Provider callbacks use /wp-json/jooosi-mail/v1/webhook/{connection_id}; see Provider webhooks for setup and verification.
For queue and connection administration from the command line, see WP-CLI reference.