The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Send test emails when in Vercel preview env (#3510)
Steven Tey73b4df9ab79a
diff --git a/packages/email/src/send-via-resend.ts b/packages/email/src/send-via-resend.tsindex 7d917bec3c..9d1f439c64 100644--- a/packages/email/src/send-via-resend.ts+++ b/packages/email/src/send-via-resend.ts@@ -21,12 +21,15 @@ const resendEmailForOptions = (unsubscribeUrl,} = opts;+ const isProdEnv = process.env.VERCEL_ENV === "production";+ const gitBranch = process.env.VERCEL_GIT_COMMIT_REF;+// Build base options without rendered outputs (react/text)// CreateEmailOptions requires at least one of react or textconst baseOptions = {- to,+ to: isProdEnv ? to : "[email protected]",from: from || VARIANT_TO_FROM_MAP[variant],- subject: subject!,+ subject: `${subject}${!isProdEnv && gitBranch ? ` [${gitBranch}]` : ""}`,bcc,// if replyTo is set to "[email protected]", don't set replyTo// else set it to the value of replyTo or fallback to [email protected]