Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions apps/sim/app/api/help/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ ${message}

// Send email using Resend
const { data, error } = await resend.emails.send({
from: `Sim <noreply@${getEmailDomain()}>`,
to: [`help@${getEmailDomain()}`],
from: `Sim <noreply@${env.EMAIL_DOMAIN || getEmailDomain()}>`,
to: [`help@${env.EMAIL_DOMAIN || getEmailDomain()}`],
subject: `[${type.toUpperCase()}] ${subject}`,
replyTo: email,
text: emailText,
Expand All @@ -121,7 +121,7 @@ ${message}
// Send confirmation email to the user
await resend.emails
.send({
from: `Sim <noreply@${getEmailDomain()}>`,
from: `Sim <noreply@${env.EMAIL_DOMAIN || getEmailDomain()}>`,
to: [email],
subject: `Your ${type} request has been received: ${subject}`,
text: `
Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions apps/sim/lib/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export const auth = betterAuth({
const html = await renderPasswordResetEmail(username, url)

const result = await resend.emails.send({
from: `Sim <team@${getEmailDomain()}>`,
from: `Sim <team@${env.EMAIL_DOMAIN || getEmailDomain()}>`,
to: user.email,
subject: getEmailSubject('reset-password'),
html,
Expand Down Expand Up @@ -251,7 +251,7 @@ export const auth = betterAuth({

// In production, send an actual email
const result = await resend.emails.send({
from: `Sim <onboarding@${getEmailDomain()}>`,
from: `Sim <onboarding@${env.EMAIL_DOMAIN || getEmailDomain()}>`,
to: data.email,
subject: getEmailSubject(data.type),
html,
Expand Down Expand Up @@ -1512,7 +1512,7 @@ export const auth = betterAuth({
)

await resend.emails.send({
from: `Sim <team@${getEmailDomain()}>`,
from: `Sim <team@${env.EMAIL_DOMAIN || getEmailDomain()}>`,
to: invitation.email,
subject: `${inviterName} has invited you to join ${organization.name} on Sim`,
html,
Expand Down
4 changes: 2 additions & 2 deletions apps/sim/lib/email/mailer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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):', {
Expand Down Expand Up @@ -132,7 +132,7 @@ export async function sendBatchEmails({
emails,
}: BatchEmailOptions): Promise<BatchSendEmailResult> {
try {
const senderEmail = `noreply@${getEmailDomain()}`
const senderEmail = `noreply@${env.EMAIL_DOMAIN || getEmailDomain()}`
const results: SendEmailResult[] = []

if (!resend) {
Expand Down