Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
feat: add new email templates for domains
Marc Seitz106ec427b990
diff --git a/components/emails/deleted-domain.tsx b/components/emails/deleted-domain.tsxnew file mode 100644index 00000000..13f2d416--- /dev/null+++ b/components/emails/deleted-domain.tsx@@ -0,0 +1,80 @@+import React from "react";+import {+ Body,+ Button,+ Container,+ Head,+ Heading,+ Html,+ Preview,+ Section,+ Text,+ Tailwind,+ Link,+ Hr,+} from "@react-email/components";++export default function DomainDeleted({+ domain = "papermark.io",+}: {+ domain: string;+}) {+ return (+ <Html>+ <Head />+ <Preview>Domain Deleted</Preview>+ <Tailwind>+ <Body className="bg-white my-auto mx-auto font-sans">+ <Container className="my-10 mx-auto p-5 w-[465px]">+ <Heading className="text-2xl font-normal text-center p-0 mt-4 mb-8 mx-0">+ <span className="font-bold tracking-tighter">Papermark</span>+ </Heading>+ <Heading className="text-xl font-seminbold text-center p-0 mt-4 mb-8 mx-0">+ Domain Deleted+ </Heading>+ <Text className="text-sm leading-6 text-black">+ Your domain <code className="text-purple-600">{domain}</code> for+ your Papermark account has been invalid for 30 days. As a result,+ it has been deleted from Papermark.+ </Text>+ <Text className="text-sm leading-6 text-black">+ If you would like to restore the domain, you can easily create it+ again on Papermark with the link below.+ </Text>+ <Section className="my-8 text-center">+ <Button+ pX={20}+ pY={12}+ className="bg-black rounded text-white text-xs font-semibold no-underline text-center"+ href={`${process.env.NEXT_PUBLIC_BASE_URL}/settings/domains`}+ >+ Set up your custom domain+ </Button>+ </Section>+ <Text className="text-sm leading-6 text-black">+ If you did not want to keep using this domain on Papermark anyway,+ you can simply ignore this email.+ </Text>+ <Hr />+ <Section className="mt-8 text-gray-400">+ <Text className="text-xs">+ © {new Date().getFullYear()}{" "}+ <a+ href="https://www.papermark.io"+ className="no-underline text-gray-400 hover:text-gray-400 visited:text-gray-400"+ target="_blank"+ >+ papermark.io+ </a>+ </Text>+ <Text className="text-xs">+ If you have any feedback or questions about this email, simply+ reply to it. I'd love to hear from you!+ </Text>+ </Section>+ </Container>+ </Body>+ </Tailwind>+ </Html>+ );+};diff --git a/components/emails/invalid-domain.tsx b/components/emails/invalid-domain.tsxnew file mode 100644index 00000000..0b357de7--- /dev/null+++ b/components/emails/invalid-domain.tsx@@ -0,0 +1,93 @@+import React from "react";+import {+ Body,+ Button,+ Container,+ Head,+ Heading,+ Html,+ Preview,+ Section,+ Text,+ Tailwind,+ Link,+ Hr,+} from "@react-email/components";++export default function InvalidDomain({+ domain = "papermark.io",+ invalidDays = 14,+}: {+ domain: string;+ invalidDays: number;+}) {+ return (+ <Html>+ <Head />+ <Preview>Domain Deleted</Preview>+ <Tailwind>+ <Body className="bg-white my-auto mx-auto font-sans">+ <Container className="my-10 mx-auto p-5 w-[465px]">+ <Heading className="text-2xl font-normal text-center p-0 mt-4 mb-8 mx-0">+ <span className="font-bold tracking-tighter">Papermark</span>+ </Heading>+ <Heading className="mx-0 my-7 p-0 text-center text-xl font-semibold text-black">+ Invalid Domain Configuration+ </Heading>+ <Text className="text-sm leading-6 text-black">+ Your domain <code className="text-purple-600">{domain}</code> for+ your Papermark account has been invalid for {invalidDays} days.+ </Text>+ <Text className="text-sm leading-6 text-black">+ If your domain remains unconfigured for 30 days, it will be+ automatically deleted from Papermark. Please click the link below+ to configure your domain.+ </Text>+ <Section className="my-8 text-center">+ <Button+ pX={20}+ pY={12}+ className="bg-black rounded text-white text-xs font-semibold no-underline text-center"+ href={`${process.env.NEXT_PUBLIC_BASE_URL}/settings/domains`}+ >+ Configure domain+ </Button>+ </Section>+ <Text className="text-sm leading-6 text-black">+ If you do not want to keep this domain on Papermark, you can{" "}+ <Link+ href={`https://www.papermark.io/settings/domains`}+ className="font-medium text-blue-600 no-underline"+ >+ delete it+ </Link>{" "}+ or simply ignore this email. To respect your inbox,{" "}+ {invalidDays < 28+ ? `we will only send you one more email about this in ${+ 28 - invalidDays+ } days.`+ : "this will be the last time we will email you about this."}+ </Text>+ <Hr />+ <Section className="mt-8 text-gray-400">+ <Text className="text-xs">+ © {new Date().getFullYear()}{" "}+ <a+ href="https://www.papermark.io"+ className="no-underline text-gray-400 hover:text-gray-400 visited:text-gray-400"+ target="_blank"+ >+ papermark.io+ </a>+ </Text>+ <Text className="text-xs">+ If you have any feedback or questions about this email, simply+ reply to it. I'd love to hear from you!+ </Text>+ </Section>+ </Container>+ </Body>+ </Tailwind>+ </Html>+ );+};diff --git a/lib/emails/send-deleted-domain.ts b/lib/emails/send-deleted-domain.tsnew file mode 100644index 00000000..60746508--- /dev/null+++ b/lib/emails/send-deleted-domain.ts@@ -0,0 +1,11 @@+import { sendEmail } from "@/lib/resend";+import DeletedDomainEmail from "@/components/emails/deleted-domain";++export const sendDeletedDomainEmail = async (email: string, domain: string) => {+ const emailTemplate = DeletedDomainEmail({ domain });+ await sendEmail({+ to: email,+ subject: `Your domain ${domain} has been deleted`,+ react: emailTemplate,+ });+};diff --git a/lib/emails/send-invalid-domain.ts b/lib/emails/send-invalid-domain.tsnew file mode 100644index 00000000..e3423b23--- /dev/null+++ b/lib/emails/send-invalid-domain.ts@@ -0,0 +1,11 @@+import { sendEmail } from "@/lib/resend";+import InvalidDomainEmail from "@/components/emails/invalid-domain";++export const sendInvalidDomainEmail = async (email: string, domain: string, invalidDays: number) => {+ const emailTemplate = InvalidDomainEmail({ domain, invalidDays });+ await sendEmail({+ to: email,+ subject: `Your domain ${domain} needs to be configured`,+ react: emailTemplate,+ });+};