From 1dfa079b1e9c7769678bcd0f2aaf465e7f089585 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Brito?= Date: Thu, 2 Jan 2025 21:05:25 -0300 Subject: [PATCH] feat: added mail sender as env --- packages/email/src/index.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/email/src/index.tsx b/packages/email/src/index.tsx index cdfb5586..be3ca64a 100644 --- a/packages/email/src/index.tsx +++ b/packages/email/src/index.tsx @@ -1,16 +1,16 @@ -import React from 'react'; -import { Resend } from 'resend'; -import type { z } from 'zod'; +import React from "react"; +import { Resend } from "resend"; +import type { z } from "zod"; -import { type TemplateKey, type Templates, templates } from './emails'; +import { type TemplateKey, type Templates, templates } from "./emails"; -const FROM = 'hello@openpanel.dev'; +const FROM = process.env.EMAIL_SENDER ?? "hello@openpanel.dev"; export async function sendEmail( template: T, options: { to: string | string[]; - data: z.infer; + data: z.infer; }, ) { const { to, data } = options; @@ -18,7 +18,7 @@ export async function sendEmail( const props = schema.safeParse(data); if (props.error) { - console.error('Failed to parse data', props.error); + console.error("Failed to parse data", props.error); return null; } @@ -46,7 +46,7 @@ export async function sendEmail( return res; } catch (error) { - console.error('Failed to send email', error); + console.error("Failed to send email", error); return null; } }