BUILD WITH OUTBOX STACK
Your first email.
Your next connection.
A clear path from your workspace to your first send. Connect your backend, send transactional email, and follow every message.
https://outboxstack.appYou’ll need a verified account, a verified sender domain, a transactional route, and a workspace API key. Use managed sending or connect your own AWS SES account. To decide between them, read Choose your setup. To build before any of that is ready, create a test key: it accepts mail without sending it.
- Create an account, verify your email and sign in.
- Open Sending providers, choose managed sending, and complete the sending-use and consent questions. Check Billing for account status and your daily limit.
- Open Domains, add a domain you control and copy the generated DNS records. Use “Check now” until verification succeeds. Keep your existing root MX records for receiving mail; the bounce-subdomain MX is separate.
- Confirm transactional routing in Sending providers. Open API keys & SMTP and create an API key. Choose Sending only for apps that just send email: the key can't change your workspace and can be locked to one sender domain. Copy it once and store it in your backend's secret manager.
Customers connect to Outbox Stack, using an Outbox Stack API key. Managed sending doesn't require customer AWS credentials. DNS verification records can identify our delivery provider. We don't host customer inboxes or receive replies.
Set MAIL_BASE_URL to https://outboxstack.app and MAIL_API_KEY to your key. Replace both email addresses with your verified sender and a real test recipient.
curl "$MAIL_BASE_URL/v1/messages" \
-H "Authorization: Bearer $MAIL_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: reset-request-unique-id" \
--data '{
"from": "accounts@your-verified-domain.com",
"fromName": "Your app",
"to": "customer@example.com",
"toName": "Ada Obi",
"replyTo": "support@your-verified-domain.com",
"subject": "Reset your password",
"text": "Use the password-reset link generated by your app."
}'A new request returns 202 {"id":"…","status":"queued"}. Repeating the same idempotency key returns the original message with HTTP 200. Use a different key for a different reset request. Accepted means queued, not delivered.
Optional fields: toName, replyTo, html, template with data in place of subject and body, cc and bcc, up to 10 attachments (base64, 10 MB in total), up to 20 custom headers, and up to 10 metadata strings that come back in GET and webhooks. to, cc and bcc take one address or a list, written ada@example.com or Ada Obi <ada@example.com>.
Each recipient (at most 50 per send) becomes its own message with its own id, status and bounce tracking, and counts as one email. The response's id is the first recipient's; recipients lists every id. Every copy shows the full To and Cc lines; Bcc never appears. Multiple recipients need managed sending, SES or SMTP.
Send up to 100 different messages at once with POST /v1/messages/batch and {"messages":[…]}; each item may carry its own idempotencyKey and succeeds or fails independently. The full contract is in the OpenAPI 3.1 spec.
npm install @getoutbox/sdkDownload the SDK and TypeScript declarations into your backend and import ./mail.js, or install npm install @getoutbox/sdk and use the package import shown below. Requires Node.js 20.3+. The release package is @getoutbox/sdk. The package is public on npm; downloadable builds remain available here.
import { Outbox } from '@getoutbox/sdk';
// Reads OUTBOX_API_KEY; the base URL defaults to https://outboxstack.app.
const mail = new Outbox();
// Your application creates and stores an expiring, single-use reset token.
// resetUrl and resetRequestId come from that trusted backend flow.
const message = await mail.send({
from: 'accounts@your-verified-domain.com',
fromName: 'Your app',
to: user.email,
toName: user.name,
replyTo: 'support@your-verified-domain.com',
subject: 'Reset your password',
text: `Reset your password: ${resetUrl}\nIgnore this if you did not request it.`,
}, { idempotencyKey: `password-reset:${resetRequestId}` });
const status = await mail.getMessage(message.id);Generate reset links in your own backend using a fixed trusted application origin. Outbox Stack delivers the message; your app owns token creation, expiry and password changes. Never expose API keys in browser or mobile code, log reset links, or insert unescaped user input into HTML.
PHP 8.2+. Install the client with Composer and set OUTBOX_API_KEY to a Sending only key.
composer require getoutbox/outbox-phpuse Outbox\Client;
$outbox = new Client(); // reads OUTBOX_API_KEY; base URL defaults to https://outboxstack.app
$result = $outbox->send([
'from' => 'accounts@your-verified-domain.com',
'fromName' => 'Your app',
'to' => 'Ada Obi <customer@example.com>',
'replyTo' => 'support@your-verified-domain.com',
'subject' => 'Reset your password',
'text' => 'Use the password-reset link generated by your app.',
'metadata' => ['user_id' => '42'],
], idempotencyKey: "password-reset:{$request->id}");
$result['id']; // message id; returned once queued, not deliveredAlso: sendBatch($messages) (1–100 messages), getMessage($id), iterateMessages(status: 'bounced', to: '@example.com') (every page), cancelMessage($id) for queued messages, and addSuppression, iterateSuppressions and removeSuppression (full-access key). Timeouts, 429 and 5xx responses are retried with the same idempotency key, so a retry never sends twice. A message must have a subject with html or text, or a template; anything else is rejected before sending. Attachment content is raw bytes; the client encodes it.
use Outbox\Exception\ApiException;
use Outbox\Exception\ConnectionException;
use Outbox\Exception\OutboxException;
try {
$outbox->send($message);
} catch (ApiException $e) {
$e->status(); // 422
$e->errorCode(); // "domain_not_verified": branch on this
$e->requestId(); // quote to support
} catch (ConnectionException $e) {
$e->idempotencyKey(); // network failure after retries: retry with this key
} catch (OutboxException $e) {
// invalid message or configuration
}Verify webhooks with Outbox\Webhook::verify($rawBody, $headers, $secret). Source and full reference: github.com/Outbox-Stack/outbox-php.
Laravel 11, 12 and 13. A mail driver, so your existing Mailables and notifications send through Outbox Stack unchanged.
composer require getoutbox/outbox-laravel// config/mail.php
'mailers' => [
'outbox' => ['transport' => 'outbox'],
],
// .env (a Sending only key from Developers)
MAIL_MAILER=outbox
OUTBOX_API_KEY=mk_...
MAIL_FROM_ADDRESS=hello@your-verified-domain.comNow Mail::to($user)->send(new InvoicePaid($invoice)) goes through Outbox Stack. Each recipient becomes its own message with its own bounce tracking. Add an X-Outbox-Idempotency-Key header to queued Mailables so job retries never send twice, and attach ->metadata('order_id', 42) to get it back in webhooks.
// .env
OUTBOX_WEBHOOK_SECRET=whsec_...
use Outbox\Laravel\Events\MessageBounced;
Event::listen(function (MessageBounced $event) {
User::where('email', $event->email())->update(['email_bounced_at' => now()]);
});The package registers POST /outbox/webhook once the secret is set, checks signatures and dispatches events such as MessageDelivered, MessageBounced and ContactUnsubscribed. Point a webhook at that URL in Developers. Source and full reference: github.com/Outbox-Stack/outbox-laravel.
Python 3.9+, no dependencies. Install it and set OUTBOX_API_KEY to a Sending only key.
pip install outboxstackfrom outboxstack import Outbox
outbox = Outbox() # reads OUTBOX_API_KEY; base URL defaults to https://outboxstack.app
result = outbox.send({
"from": "accounts@your-verified-domain.com",
"fromName": "Your app",
"to": "Ada Obi <customer@example.com>",
"replyTo": "support@your-verified-domain.com",
"subject": "Reset your password",
"text": "Use the password-reset link generated by your app.",
"metadata": {"user_id": "42"},
}, idempotency_key=f"password-reset:{request_id}")
result["id"] # message id; returned once queued, not deliveredAlso: send_batch(messages) (1–100 messages), get_message(id), iter_messages(status="bounced") (every page), cancel_message(id), suppressions, and verify_webhook(raw_body, headers, secret). Errors are OutboxApiError (branch on .code) and OutboxConnectionError. Source and full guide: Outbox-Stack/outbox-python.
Go 1.21+, no dependencies. Every call takes a context.Context.
go get github.com/Outbox-Stack/outbox-goimport outbox "github.com/Outbox-Stack/outbox-go"
client, err := outbox.New(outbox.Options{}) // reads OUTBOX_API_KEY
res, err := client.Send(ctx, outbox.Message{
From: "accounts@your-verified-domain.com",
FromName: "Your app",
To: []string{"Ada Obi <customer@example.com>"},
ReplyTo: "support@your-verified-domain.com",
Subject: "Reset your password",
Text: "Use the password-reset link generated by your app.",
Metadata: map[string]string{"user_id": "42"},
}, &outbox.SendOptions{IdempotencyKey: "password-reset:" + requestID})
// res.ID is the message id; returned once queued, not deliveredAlso: SendBatch, GetMessage, IterateMessages, CancelMessage, suppressions and VerifyWebhook. Errors are *outbox.APIError (branch on Code) and *outbox.ConnectionError, for use with errors.As. Source and full guide: Outbox-Stack/outbox-go.
Inspect GET /v1/messages/:id or add a webhook in Developers for delivery, bounce and complaint events. Verify every webhook's signature before trusting it. Webhooks use the Standard Webhooks format: webhook-id, webhook-timestamp and webhook-signature headers. With the SDK, pass the raw body: await verifyWebhook(rawBody, req.headers, secret) returns the event or throws.
List history with GET /v1/messages (newest first, up to 200 a page; pass the response's next back as after for older ones, or use the SDK's iterateMessages()). Stop a message that hasn't started sending with POST /v1/messages/:id/cancel (cancelMessage(id)); cancelling twice is safe. Manage addresses that must never receive mail with /v1/suppressions (addSuppression, removeSuppression, iterateSuppressions); these need a full-access key, and only manual suppressions can be removed.
Errors return {"error": "…", "code": "domain_not_verified", "request_id": "req_…"}. Branch on code, show error, and quote request_id (also in the X-Request-Id header) when contacting support.
| Response | Action |
|---|---|
| 400 | Fix the request: invalid_request, invalid_address, invalid_attachment, invalid_header, too_many_recipients. |
| 401 / 403 | Check the key: unauthorized, forbidden (a sending or test key outside /v1/messages), sender_domain_not_allowed, account_restricted. |
| 402 | quota_exceeded: check allowance and credits. |
| 409 | not_cancellable: the message is already sending or finished. conflict: a bounce, complaint or unsubscribe can't be removed from suppressions. |
| 422 | domain_not_verified, sending_not_configured, missing_template_data, unsupported_by_provider. |
| 429 / 503 / timeout | Retry with backoff and the same idempotency key. A timeout may follow successful acceptance. rate_limited comes with a Retry-After header; see Limits. |
The SDK retries timeouts, network errors, 429 and 5xx up to twice (maxRetries), honouring Retry-After. Every send carries an idempotency key, generated when you don't pass one, so a retry never sends twice. Pass your own key to stay safe across process restarts too. Other errors throw OutboxApiError with status, code, requestId and the response body.
Every event has type, created_at and data. Message events carry message_id, to, subject, stream (transactional or marketing), campaign_id (set for campaign email, otherwise null) and your metadata. Feedback events add recipients and occurred_at. Events can arrive more than once and out of order: deduplicate on the webhook-id header and don't let an older event overwrite a newer status.
| Event | Meaning |
|---|---|
| message.sent | The provider accepted the message. Adds provider_message_id. |
| message.delivered | The receiving mail server accepted it. Not proof that it reached the inbox rather than spam. |
| message.bounced | A hard bounce: the address doesn't exist or permanently refuses mail. Always final. The address is added to your suppressions. bounce_type is hard, and suppressed is true. |
| message.deferred | Not delivered yet, but not dead either. reason is soft_bounce (a temporary refusal, such as a full mailbox, with bounce_type soft) or delivery_delay (the provider is still retrying). After 3 soft bounces in a row with no delivery between them, the address is suppressed and suppressed is true. Don't treat this event as a bounce. |
| message.complained | The recipient marked the message as spam. The address is suppressed. |
| message.failed | The message will never be sent, for example because the provider refused it, credits ran out, or the provider never confirmed it. reason says why. Suppressed recipients don't produce this event: check the message's status. |
| message.opened / message.clicked | Open and click tracking, where the provider reports it. Opens are approximate: privacy features open mail automatically. |
| contact.subscribed / contact.unsubscribed | Someone joined a list (subscribed carries list_id) or unsubscribed. Both carry contact_id and email. |
Bounce and delay events also carry bounce_subtype (the provider's category, for example NoEmail, MailboxFull or General) and diagnostic (the receiving server's reply, such as smtp; 550 5.1.1 user unknown). Either can be null: not every provider reports them. Only managed sending and your own SES report delivery feedback (delivered, deferred, complaint, open and click events, and bounces after sending). Cloudflare reports only bounces it sees while sending, and SMTP and ZeptoMail connections report none yet.
For automated tests, CI and staging, create a key in API keys & SMTP with access set to Test. Test keys start with mk_test_. They use the same endpoints and checks as a sending key: validation, templates, sender-domain locks, idempotency and rate limits. But nothing is delivered, nothing is charged, and nothing counts toward your daily limit or reputation. They work before you've set up a provider or verified a domain.
The result depends on the recipient's name before the @, on any domain, ignoring a +tag:
| Recipient | Result |
|---|---|
| bounced@… | message.sent, then message.bounced with bounce_type: hard. Status bounced. |
| deferred@… | message.sent, then message.deferred with reason: soft_bounce. Status sent. |
| complained@… | message.sent, message.delivered, then message.complained. Status complained. |
| anything else | message.sent, then message.delivered. Status delivered. |
Addresses already on your suppression list come back as suppressed, just as in live mode. Test sends never add to that list, so suppressed in test events is always false. A send still answers 202 with queued; GET /v1/messages/:id with the same key shows the outcome straight away, with test: true. Test messages are visible only to test keys, aren't in the dashboard log, and are deleted after 30 days. To receive their events, add a webhook with Receives set to Test-key events. Live and test events never cross over, and every test event has data.test: true. Test keys work with the HTTPS API only.
| Limit | Value |
|---|---|
| API requests | 1,200 a minute per API key, for test keys too. Over that you get 429 rate_limited with Retry-After in seconds. |
| Per send | 50 recipients across to, cc and bcc. 15 MB request, attachments included. |
| Per batch | 100 messages, 1 MB request. |
| Managed daily limit | New managed accounts start at 500 emails a day (UTC). The limit doubles, at most once a day, after a day when you used at least half of it while bounces stayed at or under 2% and complaints at or under 0.05%. It grows to 100,000 a day, and no account may use more than a fifth of our shared daily sending capacity; ask support if you need more sooner. Free accounts, with no plan or credits, can send 150 a day. Email over the limit isn't rejected: it waits in the queue and goes out the next day. Billing shows your current limit. |
| Account holds | Once a managed account has sent 500 emails in a week, sending pauses for review if bounces reach 4% or complaints reach 0.08%. Queued email is kept, not dropped. |
| Your own SES | Amazon's quota for your account applies instead. A new SES account starts in the sandbox: 200 emails a day, to verified recipients only. |
Plan big sends around the daily limit. A newsletter to 5,000 people from a new managed account takes several days of steady, healthy sending to clear.
Use the hostname and port shown in Developers. Username: apikey. Password: your Outbox Stack API key. Port 587 requires STARTTLS; port 465 uses implicit TLS when enabled by the operator. Verify the server certificate.
import nodemailer from 'nodemailer';
const smtp = nodemailer.createTransport({
host: process.env.OUTBOX_SMTP_HOST,
port: 587,
secure: false,
requireTLS: true,
auth: { user: 'apikey', pass: process.env.MAIL_API_KEY },
});
await smtp.sendMail({
from: 'accounts@your-verified-domain.com',
to: 'customer@example.com',
subject: 'Reset your password',
text: 'Your trusted application reset link',
headers: { 'X-Outbox-Idempotency-Key': 'reset:unique-request-id' },
});Like the API, SMTP is for transactional messages (see Send with the API). One recipient per submission, up to 1 MiB. Attachments are not supported. Test keys don't work over SMTP. The From header must match the envelope sender. A 250 response means queued, not delivered. Use the same idempotency header when retrying an uncertain submission.
HTTPS API: available from any backend language. Node/TypeScript SDK: available as a compiled client with TypeScript source and declarations. SMTP submission: implemented with mandatory TLS and API-key authentication. Find the deployed hostname and port in Developers; if not configured yet, use the HTTPS API. Our SMTP provider setting is a separate outbound relay connection. PHP and Laravel: getoutbox/outbox-php and getoutbox/outbox-laravel on Packagist. Python and Go: outboxstack and github.com/Outbox-Stack/outbox-go. Other languages: use the HTTPS API directly, or SMTP.
To compare these methods and decide who delivers your mail, read Choose your setup.