Skip to content

Open source CapCut alternative.

TypeScript

feat(site): list mail sends from its own domain

David Led624787520c0
diff --git a/site/.env.example b/site/.env.example
index dbfcc1c6..645da4a3 100644
--- a/site/.env.example
+++ b/site/.env.example
@@ -51,6 +51,11 @@ RESEND_WEBHOOK_SECRET="replace-with-resend-webhook-signing-secret"
RESEND_REGISTERED_USERS_SEGMENT_ID="replace-with-resend-segment-id"
# The sending identity, on the Resend-verified domain.
RESEND_FROM_EMAIL="Sender Name <[email protected]>"
+# The sender for list mail — the welcome email and dashboard broadcasts — on a
+# Resend-verified subdomain. A mail provider keeps one reputation record per
+# signing domain, so bulk sends get their own and the apex above stays the
+# address a person writes from. Unset falls back to RESEND_FROM_EMAIL.
+RESEND_BULK_FROM_EMAIL="Sender Name <[email protected]>"
# Where a reply to an outreach note is forwarded so it can be answered from a
# normal inbox, with the user's own address as the reply-to. A bare address —
# it is a recipient, not a sending identity. Unset skips the forward; the row
diff --git a/site/src/lib/email/resend.ts b/site/src/lib/email/resend.ts
index 20afaf3a..f944fb9b 100644
--- a/site/src/lib/email/resend.ts
+++ b/site/src/lib/email/resend.ts
@@ -6,6 +6,15 @@ export function emailFrom(): string {
return process.env.RESEND_FROM_EMAIL ?? "";
}
+// Who list mail comes from: the welcome email, and the broadcasts sent from
+// the Resend dashboard. A mail provider keeps one reputation record per
+// signing domain, so bulk sends get a subdomain of their own and the apex in
+// RESEND_FROM_EMAIL stays the address a person writes from. Unset falls back
+// to that shared sender, which puts both streams on one domain.
+export function bulkFrom(): string {
+ return process.env.RESEND_BULK_FROM_EMAIL || emailFrom();
+}
+
// The Resend segment every account joins at signup, so broadcasts have one
// list to target: Segments → "Registered Users" in the dashboard. Empty skips
// the segment step — contacts are still created.
diff --git a/site/src/lib/email/send-welcome.ts b/site/src/lib/email/send-welcome.ts
index fa8d9a04..f88c77bd 100644
--- a/site/src/lib/email/send-welcome.ts
+++ b/site/src/lib/email/send-welcome.ts
@@ -4,6 +4,7 @@ import {
} from "@/emails/_components/logo";
import WelcomeEmail from "@/emails/welcome";
import {
+ bulkFrom,
emailFrom,
getResend,
isResendConfigured,
@@ -27,9 +28,9 @@ export async function sendWelcomeEmail(user: EmailUser): Promise<void> {
});
return;
}
- const from = emailFrom();
+ const from = bulkFrom();
if (!from) {
- console.log("[email] RESEND_FROM_EMAIL not set; skipping welcome email", {
+ console.log("[email] no sender configured; skipping welcome email", {
userId: user.id,
});
return;
@@ -53,6 +54,9 @@ export async function sendWelcomeEmail(user: EmailUser): Promise<void> {
{
from,
to: user.email,
+ // The bulk subdomain sends but does not receive; a reply goes to the
+ // apex address, where Google Workspace delivers it.
+ replyTo: emailFrom() || from,
subject: "Thanks for signing up ❤️",
react: WelcomeEmail({
credits: signupAppCredits,