Skip to content

feat(web): send our own mail straight to Amazon SES over SMTP - #668

Merged
kroqdotdev merged 1 commit into
mainfrom
mail/direct-ses
Nov 12, 2026
Merged

kroqdotdev merged 1 commit into
mainfrom
mail/direct-ses

Conversation

@kroqdotdev

Copy link
Copy Markdown
Owner

What

Moves the hooks.cc family's transactional mail off the mailcow relay and onto Amazon SES's SMTP endpoint directly. The web app and GoTrue both send from noreply@webhooks.cc with one scoped IAM user.

  • Config set and tags: every message from the app names the SES configuration set in SES_CONFIGURATION_SET (X-SES-CONFIGURATION-SET) and carries its kind as a message tag (X-SES-MESSAGE-TAGS: kind=...). Bounce and complaint events then say which mail they were about. EmailMessage.kind is now required, and every caller names one.
  • Logging: each send logs SES's message id (parsed from its 250 Ok <id> reply) together with the kind, so a bounce event can be matched to a send. Addresses and contents are never logged.
  • Resend removed: the fallback was never configured in production, so it and the resend dependency are gone. Production now requires SMTP_HOST.
  • No retry in the transport: SMTP cannot tell whether a message the connection broke on was taken, and the welcome email must never go out twice, so callers keep deciding (the pollers retry, interactive flows show the error).
  • Docs: infra/supabase/gotrue-email-auth.md describes the SES side, including why GoTrue gets its configuration set from the noreply@webhooks.cc address identity's default (GoTrue cannot add headers). AGENTS.md records the SMTP-over-API decision.

Why SMTP rather than the SESv2 API

GoTrue can only send over SMTP, so it needs a derived SMTP password whatever the app does. At about 100 messages a month, everything the API offers (config set, tags, message id, error classes) is reachable over SMTP with headers and reply codes. SMTP keeps one credential, one IAM action, one path to test and no new dependency (@aws-sdk/client-sesv2 would add about 24 packages).

Rollout

The SES config set, address identity, IAM user and SNS events are set up outside this repository. The production env change (SMTP_HOST, SMTP_USER, SMTP_PASS, and SES_CONFIGURATION_SET for the app) is applied by hand. Deploying this PR before that change is safe: without SES_CONFIGURATION_SET, no SES headers are sent and mail keeps going through mailcow.

Tests

  • pnpm test (web unit suite): 1773 passed, including a new test for the SES headers and message-id parsing.
  • tsc --noEmit and Prettier: clean.

🤖 Generated with Claude Code

@kroqdotdev kroqdotdev added the release: patch Ships a fix or small feature: the next web release bumps the patch version label Nov 12, 2026
@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7a4b755d-6400-4c93-8ea5-a9aeb9b29c95
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions

Copy link
Copy Markdown

⚠️ Deprecation Warning: The deny-licenses option is deprecated for possible removal in the next major release. For more information, see issue 997.

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

  • apps/web/package.json
  • pnpm-lock.yaml

The web app and GoTrue move off the mailcow relay onto SES's SMTP endpoint
(the SES side, IAM user and env changes live outside this repository).

- Every message names the SES configuration set from SES_CONFIGURATION_SET
  and carries its kind as an X-SES-MESSAGE-TAGS tag, so bounce and complaint
  events say which mail they were about. EmailMessage.kind is required.
- The send logs SES's message id (from its 250 reply) with the kind.
- The unused Resend fallback and the resend dependency are gone; production
  requires SMTP_HOST.
- Docs: the SES setup and why GoTrue gets its configuration set from the
  noreply@webhooks.cc address identity.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kroqdotdev
kroqdotdev merged commit e773a37 into main Nov 12, 2026
35 checks passed
@kroqdotdev
kroqdotdev deleted the mail/direct-ses branch November 12, 2026 22:06
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release: patch Ships a fix or small feature: the next web release bumps the patch version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant