fix: skip email verification entirely when no mail transport exists

SMTP-less self-hosted instances still marked every account
emailVerified=false and attempted a verification mail that could
never arrive. Now: no transport → accounts are created verified,
the send is skipped, and existing unverified rows are backfilled
on startup. .env.example stops defaulting SMTP_HOST to the
dev-only mailpit service.

Verified live: fresh signup returns emailVerified=true, legacy
unverified users flip on restart, sign-in unaffected.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Tomas DvorakandDevin committed 2026-09-28 15:43:26 +02:00
1 parent 14d0762245
commit 7548ea75d4
5 files changed
+50 -15

No files matched your search

+8
View File
@@ -30,6 +30,14 @@ async function resolveMailConfig() {
} as const;
}
// True when a mail transport exists (Resend key or SMTP host). Verification
// and reset mails only make sense when mail can actually leave the box.
export async function hasMailTransport(): Promise<boolean> {
const cfg = await resolveMailConfig();
if ("resendApiKey" in cfg && cfg.resendApiKey) return true;
return "smtp" in cfg && Boolean(cfg.smtp);
}
export async function sendTransactionalEmail(input: {
to: string;
subject: string;