TypeScript Quickstart
Send your first email with the Smail TypeScript SDK.
1. Install the SDK
npm install @smail/smail-js2. Set your API key
Create an API key in the Smail dashboard and export it as an environment variable:
export SMAIL_API_KEY=sk_live_...3. Send your first email
import { SmailClient } from "@smail/smail-js";
const smail = new SmailClient({ apiKey: process.env.SMAIL_API_KEY! });
const { email } = await smail.emails.send({
from: "you@yourdomain.com",
to: ["recipient@example.com"],
subject: "Hello from Smail",
html: "<p>Your first email sent with Smail.</p>",
text: "Your first email sent with Smail.",
});
console.log("Sent email ID:", email.id);
console.log("Status:", email.status);The from address must belong to a verified domain on your account.