@@ -3,12 +3,11 @@ import { Resend } from 'resend'
33import { z } from 'zod'
44import { env } from '@/lib/env'
55import { createLogger } from '@/lib/logs/console-logger'
6- import { getBaseDomain } from '@/lib/urls/utils'
6+ import { getEmailDomain } from '@/lib/urls/utils'
77
88const resend = env . RESEND_API_KEY ? new Resend ( env . RESEND_API_KEY ) : null
99const logger = createLogger ( 'HelpAPI' )
1010
11- // Define schema for validation
1211const helpFormSchema = z . object ( {
1312 email : z . string ( ) . email ( 'Invalid email address' ) ,
1413 subject : z . string ( ) . min ( 1 , 'Subject is required' ) ,
@@ -99,8 +98,8 @@ ${message}
9998
10099 // Send email using Resend
101100 const { data, error } = await resend . emails . send ( {
102- from : `Sim Studio <noreply@${ getBaseDomain ( ) } >` ,
103- to : [ `help@${ getBaseDomain ( ) } ` ] ,
101+ from : `Sim Studio <noreply@${ getEmailDomain ( ) } >` ,
102+ to : [ `help@${ getEmailDomain ( ) } ` ] ,
104103 subject : `[${ type . toUpperCase ( ) } ] ${ subject } ` ,
105104 replyTo : email ,
106105 text : emailText ,
@@ -122,7 +121,7 @@ ${message}
122121 // Send confirmation email to the user
123122 await resend . emails
124123 . send ( {
125- from : `Sim Studio <noreply@${ getBaseDomain ( ) } >` ,
124+ from : `Sim Studio <noreply@${ getEmailDomain ( ) } >` ,
126125 to : [ email ] ,
127126 subject : `Your ${ type } request has been received: ${ subject } ` ,
128127 text : `
@@ -137,8 +136,8 @@ ${images.length > 0 ? `You attached ${images.length} image(s).` : ''}
137136
138137Best regards,
139138The Sim Studio Team
140- ` ,
141- replyTo : `help@${ getBaseDomain ( ) } ` ,
139+ ` ,
140+ replyTo : `help@${ getEmailDomain ( ) } ` ,
142141 } )
143142 . catch ( ( err ) => {
144143 logger . warn ( `[${ requestId } ] Failed to send confirmation email` , err )
0 commit comments