SDKs
Official SDKs for Node.js, Python, Go and PHP, and a Laravel mail driver. They call the same REST API as every other example in these docs, with types, retries and webhook checks built in. You do not need one: any HTTP client works.
Install
npm install @smtpfast/sdk
| Language | Package | Runs on |
|---|---|---|
| Node.js and TypeScript | @smtpfast/sdk | Node.js 22+, Bun, Deno, edge runtimes. No runtime dependencies. |
| Python | smtpfast | Python 3.10+. Sync and async clients. Depends only on httpx. |
| Go | github.com/smtpfast/smtpfast-go | Go 1.24+. Standard library only. |
| PHP | smtpfast/smtpfast-php | PHP 8.2+ with the curl extension. No other dependencies. |
| Laravel | smtpfast/smtpfast-laravel | Laravel 12 and 13. A mail driver: existing Mailables and Notifications send through the API. |
Send an email
Create an API key, set it as SMTPFAST_API_KEY, and send from a verified domain:
import { SMTPfast } from "@smtpfast/sdk";
const smtpfast = new SMTPfast(); // reads SMTPFAST_API_KEY
const email = await smtpfast.emails.send({
from: "Acme <[email protected]>",
to: ["[email protected]"],
subject: "Your receipt",
html: "<p>Thanks for your order.</p>",
category: "transactional",
});
console.log(email.id);Email is marketing unless you set category to transactional. Marketing email gets a one-click unsubscribe header and is not sent to people who unsubscribed, so set transactional on receipts, password resets and account alerts.
What every SDK does
| Every endpoint | Each SDK is generated from the OpenAPI document, so every API operation is a method, named after its path: emails.send, domains.verify, contacts.segments.add. |
| Retries | After a 429 (honouring Retry-After), a 408, a 5xx or a dropped connection. Reads, PUT and DELETE are retried after a 5xx; other POST and PATCH calls only after a per-second rate limit, which the API rejects before doing any work. |
| Idempotency | A send, reply or forward is retried with the same Idempotency-Key, so the API returns the first answer instead of sending twice. The SDK makes a key per call when you do not give one. |
| Typed errors | One error type per status class (not found, rate limited, and so on), plus connection and timeout errors. |
| Pagination | Helpers that walk every page of a list for you. |
| Webhooks | Signature checks for incoming webhook requests, with the same rules as the webhook docs. |
Each README has the full options, error classes and pagination examples for its language.
Other languages
- Call the REST API from any HTTP client. The Quick Start has a curl example, and the OpenAPI document works with any code generator.
- Already on a Resend SDK? Point it at SMTPfast. See Resend Compatibility.
- Need SMTP? The SMTP bridge sends through the same account. See the SMTP Bridge section of Emails.