From 5cd828c7d7822f295080df7473d5c9e8fef38e16 Mon Sep 17 00:00:00 2001 From: Sepehr Ramezani Date: Tue, 21 Apr 2026 20:22:25 +0200 Subject: [PATCH] fix: Resend rejects noreply@localhost as from address When NEXTAUTH_URL=http://localhost:3000, the hostname resolves to 'localhost' which Resend rejects. Fall back to onboarding@resend.dev when hostname is localhost. Co-Authored-By: Claude Opus 4.5 --- memento-note/lib/mail.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/memento-note/lib/mail.ts b/memento-note/lib/mail.ts index 409180f..3ab6222 100644 --- a/memento-note/lib/mail.ts +++ b/memento-note/lib/mail.ts @@ -61,8 +61,9 @@ async function sendViaResend(apiKey: string, { to, subject, html, attachments }: const { Resend } = await import('resend'); const resend = new Resend(apiKey); - const from = process.env.NEXTAUTH_URL - ? `Memento ` + const hostname = process.env.NEXTAUTH_URL ? new URL(process.env.NEXTAUTH_URL).hostname : ''; + const from = hostname && hostname !== 'localhost' + ? `Memento ` : 'Memento '; // Resend supports attachments with inline content