Quickstart
Get started with Stack0 in under 5 minutes. This guide will walk you through sending your first email.
1
Install the SDK
Install the Stack0 SDK using your preferred package manager:
npm
npm install @stack0/sdk
yarn
yarn add @stack0/sdk
pnpm
pnpm add @stack0/sdk
bun
bun add @stack0/sdk
2
Set Your API Key
Add your API key to your environment variables. Get your key from the Dashboard.
.env
STACK0_API_KEY=sk_live_your_api_key
3
Send Your First Email
Initialize the SDK and send an email:
send-email.ts
import { Stack0 } from '@stack0/sdk'const stack0 = new Stack0({apiKey: process.env.STACK0_API_KEY!})const result = await stack0.mail.send({from: 'you@yourdomain.com',to: 'recipient@example.com',subject: 'Hello from Stack0!',html: '<h1>Welcome!</h1><p>This is your first email.</p>',})console.log('Email sent!', result.id)
4
Verify Your Domain (Optional)
For production use, verify your domain to improve deliverability. Go to your Dashboard and follow the domain verification steps.
You're all set!
You've successfully sent your first email with Stack0. Explore the SDK examples to learn about templates, batch sending, and more.