Skip to content

Commit 7e364a7

Browse files
authored
fix(emails): remove unused useCustomFromFormat param (#1082)
* fix(mailer): remove unused useCustomFormat * bun.lock changes
1 parent 35a37d8 commit 7e364a7

File tree

3 files changed

+1
-23
lines changed

3 files changed

+1
-23
lines changed

apps/sim/app/api/workspaces/invitations/route.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,6 @@ async function sendInvitationEmail({
250250
html: emailHtml,
251251
from: fromAddress,
252252
emailType: 'transactional',
253-
useCustomFromFormat: true,
254253
})
255254

256255
if (result.success) {

apps/sim/lib/email/mailer.test.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -218,23 +218,6 @@ describe('mailer', () => {
218218
)
219219
})
220220

221-
it('should use custom from format when useCustomFromFormat is true', async () => {
222-
const result = await sendEmail({
223-
...testEmailOptions,
224-
from: 'Sim <[email protected]>',
225-
useCustomFromFormat: true,
226-
})
227-
228-
expect(result.success).toBe(true)
229-
230-
// Should call Resend with the exact from address provided (no modification)
231-
expect(mockSend).toHaveBeenCalledWith(
232-
expect.objectContaining({
233-
from: 'Sim <[email protected]>', // Uses custom format as-is
234-
})
235-
)
236-
})
237-
238221
it.concurrent('should replace unsubscribe token placeholders in HTML', async () => {
239222
const htmlWithPlaceholder = '<p>Content</p><a href="{{UNSUBSCRIBE_TOKEN}}">Unsubscribe</a>'
240223

apps/sim/lib/email/mailer.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ export interface EmailOptions {
2626
includeUnsubscribe?: boolean
2727
attachments?: EmailAttachment[]
2828
replyTo?: string
29-
useCustomFromFormat?: boolean // If true, uses "from" as-is; if false, uses default FROM_EMAIL_ADDRESS format
3029
}
3130

3231
export interface BatchEmailOptions {
@@ -55,7 +54,6 @@ interface ProcessedEmailData {
5554
headers: Record<string, string>
5655
attachments?: EmailAttachment[]
5756
replyTo?: string
58-
useCustomFromFormat: boolean
5957
}
6058

6159
const resendApiKey = env.RESEND_API_KEY
@@ -149,7 +147,6 @@ async function processEmailData(options: EmailOptions): Promise<ProcessedEmailDa
149147
includeUnsubscribe = true,
150148
attachments,
151149
replyTo,
152-
useCustomFromFormat = false,
153150
} = options
154151

155152
const senderEmail = from || getFromEmailAddress()
@@ -186,14 +183,13 @@ async function processEmailData(options: EmailOptions): Promise<ProcessedEmailDa
186183
headers,
187184
attachments,
188185
replyTo,
189-
useCustomFromFormat,
190186
}
191187
}
192188

193189
async function sendWithResend(data: ProcessedEmailData): Promise<SendEmailResult> {
194190
if (!resend) throw new Error('Resend not configured')
195191

196-
const fromAddress = data.useCustomFromFormat ? data.senderEmail : data.senderEmail
192+
const fromAddress = data.senderEmail
197193

198194
const emailData: any = {
199195
from: fromAddress,

0 commit comments

Comments
 (0)