Run your own relay
SendAs Relay works with any copy of its relay. Running your own means your passwords and messages go only from your browser to your Cloudflare account to your email provider. It costs nothing on Cloudflare's free Workers plan and takes about ten minutes.
What you need
- A free Cloudflare account.
- Node.js 20 or newer on your computer.
- The relay's source code: published on GitHub at launch (link will appear here).
Deploy
cd sendas-relay/relay
npm install
npx wrangler login # opens your browser to authorise Wrangler for your Cloudflare account
npx wrangler deploy
Wrangler prints your relay's address, like https://sendas-relay-api.your-name.workers.dev. Open it with /health at the end; it should show {"ok": true}.
Lock it to yourself (recommended)
Anyone who knows the URL could otherwise use your relay to send through their own SMTP accounts. Add a secret token:
npx wrangler secret put RELAY_TOKEN
Type a long random value when asked. Requests without it get "401 unauthorized".
Connect the extension
- Open SendAs Relay's settings (click its toolbar icon).
- Under Relay, choose My own relay.
- Paste the URL and, if you set one, the access token.
- Click Save and check relay. You should see "Relay is reachable".
What the free plan covers
Cloudflare's Workers free plan allows 100,000 requests a day, far more than one person sends. Each message takes one request, plus one for the Sent copy. The relay keeps no data, so it needs no database or storage add-ons.
The relay's configuration also includes a rate limit (20 sends a minute per SMTP account) using Cloudflare's rate-limiting binding. If wrangler deploy complains about it, remove the ratelimits block from wrangler.jsonc and deploy again.
Updating
Pull the latest code and run npx wrangler deploy again. Extension release notes will say when a new version needs a relay update.
Check what it does
The relay is about 800 lines of JavaScript in relay/src: index.js (HTTP handling, limits, CORS), smtp.js (SMTP client), imap.js (Sent copy), wire.js (socket reading) and mime.js. Logging is disabled in wrangler.jsonc ("observability": { "enabled": false }).