Skip to main content

Getting started

Introduction

Postboi is a framework-agnostic email library optimised for SvelteKit — one API, swappable providers, zero configuration.


Postboi is a framework-agnostic email library optimised for SvelteKit. It works with a variety of email providers and turns your FormData into tidy HTML emails, with zero configuration.

Import send, call it, done — the provider and credentials come from environment variables, so the same line of code works whether you’re on Resend, Postmark, Mailgun, or any of the other supported providers.

import { send } from 'postboi';

await send({ to: 'contact@example.com', subject: 'Hi', body: '<p>Hello</p>' });
import { send } from 'postboi';

await send({ to: 'contact@example.com', subject: 'Hi', body: '<p>Hello</p>' });

Features

  • 👨‍💻 Zero configuration — works out of the box with minimal setup.
  • 🔌 Provider-based — swap email providers without changing your code.
  • 📝 Smart FormData parsing — automatically converts FormData to HTML tables.
  • 🎯 Grouped fields — organise form fields with fieldset→field syntax.
  • 📎 Attachments — attach files directly from form inputs or File objects.
  • 🛡️ Type-safe — full TypeScript support with normalised error handling.

How it fits together

There are three ways to use Postboi, from least to most explicit:

  1. Zero-config send() — reads POSTBOI_PROVIDER and credentials from the environment. Best for apps where one provider is set per environment.
  2. postboi/kit form actions — a one-line SvelteKit action that reads FormData, sends it, and returns a result.
  3. A provider instancenew Resend({ ... }) when you want an explicit instance or you’re on a runtime without ambient env vars.

Start with the Quick start and let the CLI wire everything up for you, or set things up by hand with Manual setup.

Next steps

Page What you’ll find
Quick start postboi init — pick a provider, send your first email
Manual setup Wire Postboi up by hand without the CLI
SvelteKit form actions One-line contact forms
Providers The full provider list and their options
API reference SendOptions, types, and the provider surface