Uh oh!
There was an error while loading. Please reload this page.
Feat/mailer smtp provider - #437
Conversation
@NasroelLah is attempting to deploy a commit to the kmkoushik's projects Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughAdds a configurable mailer abstraction supporting SES, SMTP, UseSend, and legacy SES transports. Provider resolution validates configuration, applies cloud or self-hosted defaults, and caches the selected transport. Existing mailer functions delegate delivery through this abstraction. The change also adds provider-specific unit tests, environment mappings, SES client export access, SaaS Docker configuration, and design/implementation documentation. Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
apps/web/src/env.jsESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox. apps/web/src/server/aws/ses.tsESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox. apps/web/src/server/mailer.tsESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox.
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
apps/web/src/server/mailer/providers/resolve.ts (1)
5-9: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse the
~/alias for app-source imports.
apps/web/src/server/mailer/providers/resolve.ts#L5-L9: replace provider and type relative imports with~/server/mailer/providers/....apps/web/src/server/mailer.ts#L4-L4: import the resolver from~/server/mailer/providers/resolve.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/web/src/server/mailer/providers/resolve.ts` around lines 5 - 9, Replace the relative provider and MailerTransport imports in apps/web/src/server/mailer/providers/resolve.ts lines 5-9 with the ~/server/mailer/providers/... alias paths. Update the resolver import in apps/web/src/server/mailer.ts line 4 to use ~/server/mailer/providers/resolve.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/web/src/env.js`:
- Around line 78-83: Update the MAILER_SMTP_PORT and MAILER_SMTP_SECURE schemas
in the environment validation configuration to reject non-numeric or
out-of-range ports, allowing only 1 through 65535, and to accept secure-mode
values only when exactly true or false. Add or update environment validation
tests covering invalid port and TLS values while preserving valid configuration
behavior.
In `@docker/prod/compose.saas.yml`:
- Around line 132-134: Update the SMTP TLS volume mounts in the compose
configuration to use the configurable LETSENCRYPT_LIVE_DIR value instead of the
hard-coded pintesia.com path, and reference the standard LetsEncrypt privkey.pem
and fullchain.pem files. Add
LETSENCRYPT_LIVE_DIR=/etc/letsencrypt/live/<your-mail-domain> to
docker/prod/.env.example-saas.
In `@docs/superpowers/plans/2026-07-30-mailer-smtp-provider.md`:
- Line 7: Align the mailer architecture around `resolveMailerTransport` and
`LegacySesTransport`: either make the resolver depend only on `(provider,
isCloud)` and inject Legacy SES dependencies through its constructor, or revise
the plan text to accurately describe the existing `env` and module-dependency
usage. Keep the documented architecture and implementation consistent.
---
Nitpick comments:
In `@apps/web/src/server/mailer/providers/resolve.ts`:
- Around line 5-9: Replace the relative provider and MailerTransport imports in
apps/web/src/server/mailer/providers/resolve.ts lines 5-9 with the
~/server/mailer/providers/... alias paths. Update the resolver import in
apps/web/src/server/mailer.ts line 4 to use ~/server/mailer/providers/resolve.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: e995a4ff-0cef-44fc-966f-712175654947
📒 Files selected for processing (19)
apps/web/src/env.jsapps/web/src/server/aws/ses.tsapps/web/src/server/mailer.tsapps/web/src/server/mailer.unit.test.tsapps/web/src/server/mailer/providers/legacy-ses.tsapps/web/src/server/mailer/providers/legacy-ses.unit.test.tsapps/web/src/server/mailer/providers/resolve.tsapps/web/src/server/mailer/providers/resolve.unit.test.tsapps/web/src/server/mailer/providers/ses.tsapps/web/src/server/mailer/providers/ses.unit.test.tsapps/web/src/server/mailer/providers/smtp.tsapps/web/src/server/mailer/providers/smtp.unit.test.tsapps/web/src/server/mailer/providers/types.tsapps/web/src/server/mailer/providers/usesend.tsapps/web/src/server/mailer/providers/usesend.unit.test.tsdocker/prod/.env.example-saasdocker/prod/compose.saas.ymldocs/superpowers/plans/2026-07-30-mailer-smtp-provider.mddocs/superpowers/specs/2026-07-30-mailer-smtp-provider-design.md
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Summary by cubic
Introduced a pluggable mailer with MAILER_PROVIDER (
ses,smtp,usesend) and refactored platform emails to use it. Default behavior is preserved: self-hosted stays on legacy SES; cloud continues using useSend.New Features
resolveMailerTransportwith cachedgetMailerTransport()and transports for SES, SMTP, and useSend.getSesClientand implemented direct SES sending via@aws-sdk/client-sesv2+nodemailer.Migration
ses,smtp, orusesend.Written for commit e260105. Summary will update on new commits.
Summary by CodeRabbit