Skip to main content

Prerequisites

To get the most out of this guide, you’ll need to:
You can find your API keys in your SendPost Dashboard. Make sure to use your Sub-Account API Key for sending emails.

1. Install Wrangler CLI

2. Initialize Worker

3. Basic Email Worker

Update src/index.ts:
TypeScript

4. Configure Worker

Update wrangler.toml:

5. Set Secrets

Set the API key as a secret:
Enter your Sub-Account API Key when prompted.

6. Deploy Worker

Deploy to Cloudflare:

7. Common Use Cases

Welcome Email Worker

Create src/welcome-email.ts:
TypeScript

8. Testing Locally

Run locally:
Test your worker:

9. Using with Pages Functions

If using Cloudflare Pages, create functions/send-email.ts:
TypeScript
Make sure your sender email domain is verified in your SendPost account before sending emails.

10. Next Steps

Explore more examples and use cases:

Cloudflare Workers

Learn more about Cloudflare Workers

Wrangler CLI

Learn more about Wrangler CLI

Quickstart Example

View a complete working example on GitHub