1
0
Fork 0
peertube/server/lib/job-queue/handlers/email.ts
2019-01-10 11:32:37 +01:00

23 lines
559 B
TypeScript

import * as Bull from 'bull'
import { logger } from '../../../helpers/logger'
import { Emailer } from '../../emailer'
export type EmailPayload = {
to: string[]
subject: string
text: string
from?: string
}
async function processEmail (job: Bull.Job) {
const payload = job.data as EmailPayload
logger.info('Processing email in job %d.', job.id)
return Emailer.Instance.sendMail(payload.to, payload.subject, payload.text, payload.from)
}
// ---------------------------------------------------------------------------
export {
processEmail
}