Repository navigation
feat(mail): send password-reset mail with mail-kit over SMTP - #5
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ExvzEi3nvXSWrvbbMYaWTQ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Himanshu · project thread
What and why
Before: password-reset links could only be sent through
MAIL_WEBHOOK_URL, a hand-built relay that posted a plain-text body. With no relay set, no email went out.After: with
SMTP_URLandMAIL_FROMset, the worker sends the password-reset mail using mail-kit. The api also sends it directly when there is no Redis. The mail is written in mail-kit's mail design language and goes out as branded HTML plus plain text, using the lab's name, address and phone from report-kit's lab profile.MAIL_WEBHOOK_URLstill works whenSMTP_URLis not set.How:
src/jobs/mailer.ts:mailKitMailerimplements the api'sMailerwith mail-kit'spassword-resettemplate.mailerFromConfigpicks mail-kit (SMTP_URL), then the webhook, then none. The api's ownmailqueue already holds the job, and the worker creates the reset token, so mail-kit gets no queue and the raw token never sits in Redis.src/config/env.ts:SMTP_URL(smtp:// or smtps://) andMAIL_FROM. In production,MAIL_FROMis required wheneverSMTP_URLis set.kits.jsonandpackage.json: mail-kit at the merge commit of mail-kit feat: GraphQL backend over the kits, one endpoint #1.Type
Checklist
main)npm run typecheckpassesTEST_BACKENDS=pg npm test: 104 passed; 8 new[mail]checks covering the rendered reset mail, escaping, IST expiry, brand footer and config rules)🤖 Generated with Claude Code
https://claude.ai/code/session_01ExvzEi3nvXSWrvbbMYaWTQ
Generated by Claude Code