feat: add optional plain-text fallback to sendEmail
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -38,6 +38,7 @@ export async function sendEmail(
|
|||||||
subject: string,
|
subject: string,
|
||||||
html: string,
|
html: string,
|
||||||
from?: string,
|
from?: string,
|
||||||
|
text?: string,
|
||||||
): Promise<nodemailer.SentMessageInfo> {
|
): Promise<nodemailer.SentMessageInfo> {
|
||||||
const transporter = createTransporter();
|
const transporter = createTransporter();
|
||||||
|
|
||||||
@@ -46,12 +47,10 @@ export async function sendEmail(
|
|||||||
to: Array.isArray(to) ? to.join(', ') : to,
|
to: Array.isArray(to) ? to.join(', ') : to,
|
||||||
subject,
|
subject,
|
||||||
html,
|
html,
|
||||||
|
...(text ? { text } : {}),
|
||||||
});
|
});
|
||||||
|
|
||||||
logger.debug(
|
logger.debug({ messageId: info.messageId, to, subject }, 'Email sent');
|
||||||
{ messageId: info.messageId, to, subject },
|
|
||||||
'Email sent',
|
|
||||||
);
|
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user