Skip to content

Open source CapCut alternative.

TypeScript

fix(site): a personal note arrives as plain text

David Lebdc76d38bff4
diff --git a/site/src/emails/outreach.tsx b/site/src/emails/outreach.tsx
deleted file mode 100644
index 2044b7cd..00000000
--- a/site/src/emails/outreach.tsx
+++ /dev/null
@@ -1,81 +0,0 @@
-import {
- Body,
- Container,
- Head,
- Html,
- Link,
- Preview,
- Tailwind,
- Text,
- pixelBasedPreset,
-} from "react-email";
-import { Fragment } from "react";
-
-// The shell every outreach note is written into: the operator's text as
-// paragraphs and one grey line to unsubscribe. It reads like a note a person
-// typed, so there is no letterhead. The words come from a
-// template in src/lib/marketing/templates/ or straight from the send dialog,
-// already filled for this recipient. Preview with `npm run email:dev`. This
-// module stays pure — the react-email preview server bundles it on its own, so
-// everything it needs comes in as props and link URLs are absolute.
-
-type OutreachEmailProps = {
- /** Plain text. A blank line starts a paragraph, a single newline breaks a
- * line. */
- body: string;
- unsubscribeUrl: string;
-};
-
-function paragraphs(body: string): string[] {
- return body
- .split(/\n\s*\n/)
- .map((block) => block.trim())
- .filter((block) => block.length > 0);
-}
-
-export default function OutreachEmail({ body, unsubscribeUrl }: OutreachEmailProps) {
- const blocks = paragraphs(body);
- return (
- <Html>
- <Head />
- <Preview>{blocks[0] ?? ""}</Preview>
- <Tailwind config={{ presets: [pixelBasedPreset] }}>
- <Body className="bg-white font-sans text-[#0F0E0D]">
- <Container className="mx-auto max-w-[520px] px-6 py-12">
- {blocks.map((block, index) => (
- <Text key={index} className="text-[15px] leading-relaxed">
- {block.split("\n").map((line, lineIndex) => (
- <Fragment key={lineIndex}>
- {lineIndex > 0 ? <br /> : null}
- {line}
- </Fragment>
- ))}
- </Text>
- ))}
- <Text className="mt-8 text-[12px] leading-relaxed text-[#0F0E0D]/50">
- <Link
- href={unsubscribeUrl}
- className="text-[#0F0E0D]/50 underline"
- >
- Unsubscribe
- </Link>{" "}
- from product emails.
- </Text>
- </Container>
- </Body>
- </Tailwind>
- </Html>
- );
-}
-
-OutreachEmail.PreviewProps = {
- body: `Hey Ada,
-
-I'm David — I build Donkey Cut. I saw you've been using the AI features.
-
-What are you making?
-
-Thanks,
-David`,
- unsubscribeUrl: "https://donkeycut.com/unsubscribe?token=preview",
-} satisfies OutreachEmailProps;
diff --git a/site/src/lib/marketing/send-outreach.ts b/site/src/lib/marketing/send-outreach.ts
index 23bc17de..da82353f 100644
--- a/site/src/lib/marketing/send-outreach.ts
+++ b/site/src/lib/marketing/send-outreach.ts
@@ -1,15 +1,10 @@
-import OutreachEmail from "@/emails/outreach";
import {
emailFrom,
getResend,
isResendConfigured,
type EmailUser,
} from "@/lib/email/resend";
-import {
- isMarketingUnsubscribed,
- unsubscribeActionUrl,
- unsubscribePageUrl,
-} from "@/lib/email/unsubscribe";
+import { isMarketingUnsubscribed, unsubscribePageUrl } from "@/lib/email/unsubscribe";
import { outreachReplyAddress } from "@/lib/marketing/replyAddress";
import {
fillOutreachText,
@@ -38,10 +33,17 @@ type SendOutreachInput = {
vars: OutreachVars;
};
-// Sends one outreach note. Promotional mail, so it checks the opt-out first and
-// carries the one-click unsubscribe headers alongside the link in the message.
-// The reply-to is the row's own address: a reply comes back through Resend
-// Inbound and finds its row without matching on the sender.
+// One person writing to one person, so the message goes out as text/plain with
+// no markup, no template shell, and no bulk-mail headers. A mail provider reads
+// an HTML body or a `List-Unsubscribe` header as a mailing list and files the
+// note under promotions; the opt-out still rides along as a line of text and
+// the send still checks it first.
+function outreachText(body: string, unsubscribeUrl: string): string {
+ return `${body.trim()}\n\n--\nUnsubscribe from product emails: ${unsubscribeUrl}\n`;
+}
+
+// Sends one outreach note. The reply-to is the row's own address: a reply comes
+// back through Resend Inbound and finds its row without matching on the sender.
export async function sendOutreachEmail({
attempt,
body,
@@ -79,16 +81,7 @@ export async function sendOutreachEmail({
to: user.email,
replyTo: outreachReplyAddress(outreachId),
subject: filledSubject,
- react: OutreachEmail({
- body: filledBody,
- unsubscribeUrl: unsubscribePageUrl(user.id),
- }),
- // RFC 8058 one-click: mail providers POST here with no session; the
- // signed token in the URL is the authorization.
- headers: {
- "List-Unsubscribe": `<${unsubscribeActionUrl(user.id)}>`,
- "List-Unsubscribe-Post": "List-Unsubscribe=One-Click",
- },
+ text: outreachText(filledBody, unsubscribePageUrl(user.id)),
},
{ idempotencyKey: `outreach:${outreachId}:${attempt}` },
);