16 lines
492 B
TypeScript
16 lines
492 B
TypeScript
|
import { Mail } from '../types.ts'
|
||
|
import { transporter } from './transporter.ts'
|
||
|
|
||
|
export function send(mail: Mail) {
|
||
|
return transporter.sendMail({
|
||
|
from: mail.options.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 })),
|
||
|
})
|
||
|
}
|