OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.
feat: added mail sender as env
André Brito1dfa079b1e9c
diff --git a/packages/email/src/index.tsx b/packages/email/src/index.tsxindex cdfb55867..be3ca64a0 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 = '[email protected]';+const FROM = process.env.EMAIL_SENDER ?? "[email protected]";export async function sendEmail<T extends TemplateKey>(template: T,options: {to: string | string[];- data: z.infer<Templates[T]['schema']>;+ data: z.infer<Templates[T]["schema"]>;},) {const { to, data } = options;@@ -18,7 +18,7 @@ export async function sendEmail<T extends TemplateKey>(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<T extends TemplateKey>(return res;} catch (error) {- console.error('Failed to send email', error);+ console.error("Failed to send email", error);return null;}}