mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-06 03:00:16 -04:00
fix(mailer): update mailer to use the EMAIL_DOMAIN (#914)
* fix(mailer): update mailer to use the EMAIL_DOMAIn * add more
This commit is contained in:
@@ -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,
|
||||
@@ -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: `
|
||||
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
@@ -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,
|
||||
@@ -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,
|
||||
|
||||
@@ -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<BatchSendEmailResult> {
|
||||
try {
|
||||
const senderEmail = `noreply@${getEmailDomain()}`
|
||||
const senderEmail = `noreply@${env.EMAIL_DOMAIN || getEmailDomain()}`
|
||||
const results: SendEmailResult[] = []
|
||||
|
||||
if (!resend) {
|
||||
|
||||
Reference in New Issue
Block a user