Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
removed nodemailer
sammit badodekar00e269f4b86e
diff --git a/components/emails/login-link.tsx b/components/emails/login-link.tsxnew file mode 100644index 00000000..0fb1e6e0--- /dev/null+++ b/components/emails/login-link.tsx@@ -0,0 +1,50 @@+import React from "react";+import {+ Body,+ Button,+ Container,+ Head,+ Heading,+ Html,+ Preview,+ Section,+ Text,+ Tailwind,+ Link,+ Hr,+} from "@react-email/components";++const LoginLink = ({ email, url }: { email: string; url: string }) => {+ return (+ <Html>+ <Head />+ <Preview>Your Papermark Login Link</Preview>+ <Tailwind>+ <Body className="mx-auto my-auto bg-white font-sans">+ <Container className="mx-auto my-10 max-w-[500px] rounded border border-solid border-gray-200 px-10 py-5">+ <Heading className="mx-0 my-7 p-0 text-center text-xl font-semibold text-black">+ Your <span className="font-bold tracking-tighter">Papermark</span>{" "}+ Login Link+ </Heading>+ <Text className="text-sm leading-6 text-black">+ Welcome to Papermark!+ </Text>+ <Text className="text-sm leading-6 text-black">+ Please click the magic link below to sign in to your account.+ </Text>+ <Section className="my-8 text-center">+ <Link+ className="bg-black rounded text-white text-xs p-2 px-6 font-semibold no-underline text-center"+ href={url}+ >+ Sign in+ </Link>+ </Section>+ </Container>+ </Body>+ </Tailwind>+ </Html>+ );+};++export default LoginLink;diff --git a/package-lock.json b/package-lock.jsonindex c9155cd2..fb892ffc 100644--- a/package-lock.json+++ b/package-lock.json@@ -77,7 +77,6 @@"@types/js-cookie": "^3.0.4","@types/ms": "^0.7.32","@types/ua-parser-js": "^0.7.37",- "nodemailer": "^6.9.7","prisma": "^4.16.2"},"engines": {@@ -7673,7 +7672,8 @@"version": "6.9.7","resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.7.tgz","integrity": "sha512-rUtR77ksqex/eZRLmQ21LKVH5nAAsVicAtAYudK7JgwenEDZ0UIQ1adUGqErz7sMkWYxWTTU1aeP2Jga6WQyJw==",- "devOptional": true,+ "optional": true,+ "peer": true,"engines": {"node": ">=6.0.0"}@@ -16069,7 +16069,8 @@"version": "6.9.7","resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.7.tgz","integrity": "sha512-rUtR77ksqex/eZRLmQ21LKVH5nAAsVicAtAYudK7JgwenEDZ0UIQ1adUGqErz7sMkWYxWTTU1aeP2Jga6WQyJw==",- "devOptional": true+ "optional": true,+ "peer": true},"nopt": {"version": "6.0.0",diff --git a/package.json b/package.jsonindex de472f07..17c3c67e 100644--- a/package.json+++ b/package.json@@ -83,7 +83,6 @@"@types/js-cookie": "^3.0.4","@types/ms": "^0.7.32","@types/ua-parser-js": "^0.7.37",- "nodemailer": "^6.9.7","prisma": "^4.16.2"}}diff --git a/pages/api/auth/[...nextauth].ts b/pages/api/auth/[...nextauth].tsindex 212481b2..17e06bb5 100644--- a/pages/api/auth/[...nextauth].ts+++ b/pages/api/auth/[...nextauth].ts@@ -6,6 +6,8 @@ import { CreateUserEmailProps, CustomUser } from "@/lib/types";import { sendWelcomeEmail } from "@/lib/emails/send-welcome";import { analytics, identifyUser, trackAnalytics } from "@/lib/analytics";import EmailProvider from "next-auth/providers/email";+import { sendEmail } from "@/lib/resend";+import LoginLink from "@/components/emails/login-link";const VERCEL_DEPLOYMENT = !!process.env.VERCEL_URL;@@ -16,15 +18,13 @@ export const authOptions: NextAuthOptions = {clientSecret: process.env.GOOGLE_CLIENT_SECRET as string,}),EmailProvider({- server: {- host: process.env.SMTP_HOST,- port: process.env.SMTP_PORT,- auth: {- user: process.env.SMTP_USER,- pass: process.env.SMTP_PASSWORD,- },+ sendVerificationRequest({ identifier, url }) {+ sendEmail({+ to: identifier,+ subject: "Your Papermark Login Link",+ react: LoginLink({ url, email: identifier }),+ });},- from: process.env.EMAIL_FROM,}),],adapter: PrismaAdapter(prisma),diff --git a/pages/login.tsx b/pages/login.tsxindex 29314030..8ad9949f 100644--- a/pages/login.tsx+++ b/pages/login.tsx@@ -44,7 +44,7 @@ export default function Login() {}}><Input className=" border-4" placeholder="[email protected]" />- <Button type="submit">Continue with email</Button>+ <Button type="submit">Continue with Email</Button></form><p className="text-center">or</p><div className="flex flex-col p-4 sm:px-16">