Postmark Email
Configure Postmark for transactional streams and template-first sends.
Use Postmark when you want transactional-only delivery, message streams, and strong template support. ViteHub maps the shared email surface to Postmark's send and template APIs so your authoring layer stays portable.
Install the SDK
Terminal
pnpm add https://pkg.pr.new/vite-hub/vitehub/@vitehub/email@main postmark
Set POSTMARK_SERVER_TOKEN in the runtime environment, or pass email.serverToken directly in config.
Configure Postmark
nuxt.config.ts
export default defineNuxtConfig({
modules: ['@vitehub/email/nuxt'],
email: {
provider: 'postmark',
serverToken: process.env.POSTMARK_SERVER_TOKEN,
messageStream: 'outbound',
defaults: {
from: 'Acme <hello@example.com>',
},
},
})
Send with Postmark
Postmark works with direct message payloads and template sends through the same shared ViteHub surface.
const email = await createEmailClient()
await email.send({
from: 'Acme <hello@example.com>',
to: 'max@example.com',
delivery: {
labels: ['welcome'],
tracking: {
opens: true,
clicks: 'html',
},
template: {
key: 'welcome-template',
data: { name: 'Max' },
},
},
})
What changes on Postmark
| Concern | Behavior |
|---|---|
metadata | ViteHub maps metadata to Metadata. |
delivery.labels[0] | ViteHub maps the first label to Tag. |
delivery.template.key | A numeric key becomes TemplateId. A string key becomes TemplateAlias. |
delivery.template.data | ViteHub maps template data to TemplateModel. |
delivery.tracking | ViteHub maps tracking to TrackOpens and TrackLinks. |
email.messageStream | The top-level config becomes the default MessageStream for each send. |
| Batch sending | ViteHub uses Postmark's native batch APIs when available and falls back to fanout sends otherwise. |
Use delivery.transport for Postmark-only payload fields such as MessageStream, InlineCss, or any raw Postmark payload options.
const email = await createEmailClient()
await email.send({
from: 'Acme <hello@example.com>',
to: 'max@example.com',
subject: 'Welcome',
html: '<p>Welcome</p>',
text: 'Welcome',
delivery: {
labels: ['welcome'],
transport: {
InlineCss: true,
MessageStream: 'broadcast',
},
},
})
Top-level email.messageStream stays useful as the default stream. delivery.transport.MessageStream lets you override it for a specific send.
Choose Postmark when you want transactional-only delivery with message streams and template APIs that map cleanly from shared email fields.