mailer/src/send.ts

16 lines
489 B
TypeScript
Raw Normal View History

2024-03-29 16:37:35 +01:00
import type { Mail } from '../types.ts'
import { transporter } from './transporter.ts'
export function send(mail: Mail) {
return transporter.sendMail({
2024-03-29 16:06:20 +01:00
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: 'Text only',
html: mail.body.toString(),
attachments: mail.options.attachments.map((path) => ({ path })),
})
}