Skip to content

Testing

Never test with made-up addresses at real domains: they bounce and hurt your sender reputation. SpacePost provides test inboxes at test.spacepost.dev. Mail to them is never delivered anywhere, but the full event pipeline runs, including webhooks.

Address Simulates Events you will see
delivered@test.spacepost.dev Successful delivery email.sent, email.delivered
bounced@test.spacepost.dev Hard bounce (permanent) email.sent, email.bounced
complained@test.spacepost.dev Recipient marks as spam email.sent, email.delivered, email.complained
delayed@test.spacepost.dev Temporary delivery problem email.sent, email.delivery_delayed
softbounced@test.spacepost.dev Soft bounce (mailbox full); the third within 30 days suppresses the address email.sent, email.delivery_delayed

Add +label to run multiple scenarios in parallel and tell them apart: delivered+signup@test.spacepost.dev, bounced+case-17@test.spacepost.dev. The label is ignored when choosing the outcome.

Before you verify a domain you can send from onboarding@test.spacepost.dev. It is restricted:

  • it can send only to your own team members’ email addresses and to @test.spacepost.dev addresses;
  • any other recipient is rejected with 403 validation_error;
  • once your domain is verified, send from your own address.
test.ts
import { SpacePost } from "@spacepost/node";
const spacepost = new SpacePost(process.env.SPACEPOST_API_KEY);
await spacepost.emails.send({
from: "Acme <onboarding@test.spacepost.dev>",
to: ["delivered@test.spacepost.dev", "bounced+case-1@test.spacepost.dev"],
subject: "Test",
html: "<p>Test</p>",
});
  1. Create a webhook that points at a tunnel to your machine (for example https://abc123.ngrok.app/webhooks/spacepost), subscribed to the events you handle.
  2. Send to delivered@, bounced@, complained@ and delayed@.
  3. Check that your handler verifies the signature and responds 2xx.

Test sends count toward your monthly quota like any other email.