import type { Mail } from '../types.ts' import { renderTemplate } from './template.tsx' import { transporter } from './transporter.ts' export async function send(mail: Mail) { const { html, text } = await renderTemplate(mail.body) return transporter.sendMail({ from: mail.from.toString(), to: mail.to.map((contact) => contact.toString()), cc: mail.options.cc.map((cc) => cc.toString()), bcc: mail.options.cci.map((cci) => cci.toString()), subject: mail.subject, text, html, attachments: mail.options.attachments.map((path) => ({ path })), }) }