Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

feat: add plaintext to emails

Marc Seitz337a6d46b2d6
diff --git a/lib/resend.ts b/lib/resend.ts
index 8ad4dac9..78a0ff94 100644
--- a/lib/resend.ts
+++ b/lib/resend.ts
@@ -1,5 +1,6 @@
import { JSXElementConstructor, ReactElement } from "react";
+import { render } from "@react-email/components";
import { Resend } from "resend";
import { log, nanoid } from "@/lib/utils";
@@ -34,6 +35,8 @@ export const sendEmail = async ({
throw new Error("Resend not initialized");
}
+ const plainText = await render(react, { plainText: true });
+
try {
const { data, error } = await resend.emails.send({
from: marketing
@@ -51,6 +54,7 @@ export const sendEmail = async ({
subject,
react,
scheduledAt,
+ text: plainText,
headers: {
"X-Entity-Ref-ID": nanoid(),
},