Send email from your server through Resend or Cloudflare, and write messages as Markdown or Vue templates.
server/api/welcome.post.tsSame on every host
import { defineEventHandler } from 'h3'
import { email } from 'vite-hub/email'
export default defineEventHandler(async () => {
// Render server/emails/welcome.md. TypeScript checks `data` against the template.
const [error, sent] = await email.send({
template: 'welcome',
data: { user: { name: 'Ada' } },
from: '[email protected]',
to: '[email protected]',
})
if (error) throw error
return sent
})Deploy on
Node / Docker: Resend / SMTP / custom, set with email.driver
Pick a provider in one place
Choose Resend or Cloudflare Email in your Vite config. Your routes stay the same.
Write emails in Markdown or Vue
Files in
server/emails become typed templates. email.send({ template, data }) renders HTML and text.