Pass hooks to any provider to run awaitable callbacks around every send. before.send can
observe, rewrite, or cancel a message; the rest are best-effort observers: an error they
throw is swallowed, so logging and telemetry can never break a send. In a bulk mail(array), hooks run once per message.
Define them once in postboi.config.ts and they apply everywhere, including
the zero-config mail():
The hooks
Cancelling a send
Cancel a send from before.send by throwing SkipSendError (e.g. a suppressed or
unsubscribed recipient). It’s a PostboiError with code: "skipped", and it does not trigger on.error: