diff --git a/apps/analytics-mailer/src/index.ts b/apps/analytics-mailer/src/index.ts index 229c982..d25159e 100644 --- a/apps/analytics-mailer/src/index.ts +++ b/apps/analytics-mailer/src/index.ts @@ -166,13 +166,17 @@ async function main() { if (!SMTP_HOST) { throw new Error("SMTP_HOST is missing for live run."); } - await transporter.sendMail({ - from: SMTP_SENDER, - to: client.clientEmail, - subject, - html, - }); - console.log(`Successfully sent to ${client.clientEmail}`); + + const recipients = client.clientEmail.split(',').map(e => e.trim()).filter(e => e.length > 0); + for (const recipient of recipients) { + await transporter.sendMail({ + from: SMTP_SENDER, + to: recipient, + subject, + html, + }); + console.log(`Successfully sent to ${recipient}`); + } } } catch (e: any) { const errorMsg = e.response?.data || e.message;