MCPcopy Index your code
hub / github.com/simstudioai/sim / prepareBatch

Function prepareBatch

apps/sim/lib/messaging/email/mailer.ts:128–152  ·  view source on GitHub ↗
(emails: EmailOptions[])

Source from the content-addressed store, hash-verified

126}
127
128async function prepareBatch(emails: EmailOptions[]): Promise<PreparedBatchEntry[]> {
129 return Promise.all(
130 emails.map(async (email, index): Promise<PreparedBatchEntry> => {
131 try {
132 const allowed = await applyBanList(email)
133 if (!allowed) {
134 return { index, data: null, skippedResult: SKIPPED_BANNED_RESULT }
135 }
136 if (await shouldSkipForUnsubscribe(allowed)) {
137 return { index, data: null, skippedResult: SKIPPED_UNSUBSCRIBED_RESULT }
138 }
139 return { index, data: processEmailData(allowed), skippedResult: null }
140 } catch (error) {
141 return {
142 index,
143 data: null,
144 skippedResult: {
145 success: false,
146 message: getErrorMessage(error, 'Failed to prepare email'),
147 },
148 }
149 }
150 })
151 )
152}
153
154export async function sendBatchEmails(options: BatchEmailOptions): Promise<BatchSendEmailResult> {
155 try {

Callers 1

sendBatchEmailsFunction · 0.85

Calls 4

shouldSkipForUnsubscribeFunction · 0.90
processEmailDataFunction · 0.90
getErrorMessageFunction · 0.90
applyBanListFunction · 0.85

Tested by

no test coverage detected