Looking for the HTTP endpoints instead, for managing lists, domains, webhooks, and
members over curl? That’s the REST API.
Provider class
Every provider exposes the same surface:
See Providers for each provider’s credential option names. The zero-config
equivalents are mail() and cancel() from the package root.
Postboi provider methods
The Postboi provider adds account methods on top of the common surface:
import { mail } from 'postboi'
await mail.messages.get(id)
await mail.messages.reschedule(id, when)
await mail.lists.all()
await mail.lists.create(name, { confirmation? })
await mail.lists.get(name_or_id)
await mail.lists.update(name_or_id, { name?, confirmation? })
await mail.lists.rename(name_or_id, name)
await mail.lists.delete(name_or_id)
await mail.recipients.add(name_or_id, recipients, { status? })
await mail.recipients.set_status(name_or_id, email, status)
await mail.recipients.remove(name_or_id, email)
await mail.lists.broadcast(name_or_id, { from?, reply_to?, subject, body?, text?, scheduled_at? })
await mail.lists.broadcast(name_or_id, { channel: "sms", text, from?, send_via?, scheduled_at? })
await mail.lists.broadcast(name_or_id, { channel: "whatsapp", template, variables?, language?, from?, send_via?, scheduled_at? })
await mail.notifications.all(name_or_id)
await mail.notifications.create(name_or_id, { recipients, from?, subject?, body?, schedule })
await mail.notifications.update(name_or_id, id, changes)
await mail.notifications.delete(name_or_id, id)
await mail.suppressions.all()
await mail.suppressions.add(email)
await mail.suppressions.remove(email)
await mail.forms.all()
await mail.exports.download({ filter?, format?, columns?, fields? })
await mail.exports.all()
await mail.exports.get(id)
await mail.exports.create({ name, recipients, from?, filter?, format?, columns?, fields?, window?, schedule })
await mail.exports.update(id, changes)
await mail.exports.run(id)
await mail.exports.delete(id)
typescript SendOptions
body accepts a string of HTML, a FormData object, or a promise resolving
to either, so you can pass a template renderer’s output straight through; see Email templates. formatter controls how grouped-field labels are rendered. headers and tags are forwarded to each
provider’s native concept. See Custom headers & tags. captcha adjusts the built-in spam protection for a single send.
Common constructor options
Every provider also accepts these, on top of its own credentials:
See Errors & retries for retry behaviour, Hooks for the hooks shape, and Spam protection for captcha.
Email type
All accepted address formats:
PostboiError
The normalised error thrown by every provider. See Errors & retries for
usage.
postboi/webhooks
Receive delivery events, normalized across providers. See Webhooks.
On SvelteKit, webhook(handler, options?) from postboi/kit wraps receive as a
ready-made +server.ts request handler.