diff --git a/apps/sim/app/api/help/route.ts b/apps/sim/app/api/help/route.ts index e1bb6f8234..e21ab0353c 100644 --- a/apps/sim/app/api/help/route.ts +++ b/apps/sim/app/api/help/route.ts @@ -98,8 +98,8 @@ ${message} // Send email using Resend const { data, error } = await resend.emails.send({ - from: `Sim `, - to: [`help@${getEmailDomain()}`], + from: `Sim `, + to: [`help@${env.EMAIL_DOMAIN || getEmailDomain()}`], subject: `[${type.toUpperCase()}] ${subject}`, replyTo: email, text: emailText, @@ -121,7 +121,7 @@ ${message} // Send confirmation email to the user await resend.emails .send({ - from: `Sim `, + from: `Sim `, to: [email], subject: `Your ${type} request has been received: ${subject}`, text: ` @@ -137,7 +137,7 @@ ${images.length > 0 ? `You attached ${images.length} image(s).` : ''} Best regards, The Sim Team `, - replyTo: `help@${getEmailDomain()}`, + replyTo: `help@${env.EMAIL_DOMAIN || getEmailDomain()}`, }) .catch((err) => { logger.warn(`[${requestId}] Failed to send confirmation email`, err) diff --git a/apps/sim/lib/auth.ts b/apps/sim/lib/auth.ts index 496abe3aa0..fdce33cd63 100644 --- a/apps/sim/lib/auth.ts +++ b/apps/sim/lib/auth.ts @@ -165,7 +165,7 @@ export const auth = betterAuth({ const html = await renderPasswordResetEmail(username, url) const result = await resend.emails.send({ - from: `Sim `, + from: `Sim `, to: user.email, subject: getEmailSubject('reset-password'), html, @@ -251,7 +251,7 @@ export const auth = betterAuth({ // In production, send an actual email const result = await resend.emails.send({ - from: `Sim `, + from: `Sim `, to: data.email, subject: getEmailSubject(data.type), html, @@ -1512,7 +1512,7 @@ export const auth = betterAuth({ ) await resend.emails.send({ - from: `Sim `, + from: `Sim `, to: invitation.email, subject: `${inviterName} has invited you to join ${organization.name} on Sim`, html, diff --git a/apps/sim/lib/email/mailer.ts b/apps/sim/lib/email/mailer.ts index 772faf35d6..25aa227346 100644 --- a/apps/sim/lib/email/mailer.ts +++ b/apps/sim/lib/email/mailer.ts @@ -68,7 +68,7 @@ export async function sendEmail({ } } - const senderEmail = from || `noreply@${getEmailDomain()}` + const senderEmail = from || `noreply@${env.EMAIL_DOMAIN || getEmailDomain()}` if (!resend) { logger.info('Email not sent (Resend not configured):', { @@ -132,7 +132,7 @@ export async function sendBatchEmails({ emails, }: BatchEmailOptions): Promise { try { - const senderEmail = `noreply@${getEmailDomain()}` + const senderEmail = `noreply@${env.EMAIL_DOMAIN || getEmailDomain()}` const results: SendEmailResult[] = [] if (!resend) {