2024-03-29 16:02:26 +01:00
|
|
|
import { 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(),
|
2024-03-29 16:02:26 +01:00
|
|
|
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 })),
|
|
|
|
})
|
|
|
|
}
|