Commit | Line | Data |
---|---|---|
9aef1431 JB |
1 | import { ThreadWorker } from 'poolifier' |
2 | import { createTransport } from 'nodemailer' | |
f8374594 | 3 | import type SMTPTransport from 'nodemailer/lib/smtp-transport/index.js' |
ef083f7b | 4 | import type { WorkerData } from './types.js' |
9aef1431 | 5 | |
f8374594 JB |
6 | class SmtpClientWorker extends ThreadWorker< |
7 | WorkerData, | |
8 | SMTPTransport.SentMessageInfo | |
9 | > { | |
9aef1431 JB |
10 | public constructor () { |
11 | super({ | |
12 | nodemailer: async (workerData?: WorkerData) => { | |
f8374594 | 13 | return await createTransport(workerData?.smtpTransport).sendMail( |
67f3f2d6 | 14 | workerData!.mail |
9aef1431 JB |
15 | ) |
16 | } | |
17 | }) | |
18 | } | |
19 | } | |
20 | ||
21 | export const smtpClientWorker = new SmtpClientWorker() |