Postbote
Adapters

SendGrid

Send through SendGrid with its native SDK or direct HTTP API.

Native SDK

Terminal
pnpm add @postbote/core @postbote/adapter-sendgrid
src/lib/mailer.ts
import { sendgrid } from "@postbote/adapter-sendgrid";

const adapter = sendgrid({ apiKey: process.env.SENDGRID_API_KEY! });

Pass client to use a preconfigured @sendgrid/mail instance.

HTTP adapter

Terminal
pnpm add @postbote/core @postbote/adapter-sendgrid-http
src/lib/mailer.ts
import { sendgridHttp } from "@postbote/adapter-sendgrid-http";

const adapter = sendgridHttp({
  apiKey: process.env.SENDGRID_API_KEY!,
  timeoutMs: 30_000,
});

SendGrid returns 202 Accepted with no response body. Both adapters read the provider message ID from the X-Message-Id response header.

SendGrid does not expose a synchronous recipient-rejected failure, so that case is intentionally skipped in its adapter contract test.

On this page