Skip to content

Commit

Permalink
feat: log email sends
Browse files Browse the repository at this point in the history
  • Loading branch information
mplewis committed Oct 5, 2024
1 parent 8a8ed82 commit 2da3bda
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/src/lib/email/send.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { MAIL_SENDER } from 'src/api.config'
import { CI } from 'src/app.config'
import { mailer } from 'src/lib/mailer'

import { logger } from '../logger'

import { Plain } from './plain'

interface Params {
Expand All @@ -20,5 +22,6 @@ export async function sendEmail({ subject, text, ...p }: Params) {
const { name, email } = MAIL_SENDER
const from = `"${name}" <${email}>`
const to = Array.isArray(p.to) ? p.to : [p.to]
logger.info({ from, to, subject, text }, 'Sending email')
return mailer.send(Plain({ text }), { subject, from, to })
}

0 comments on commit 2da3bda

Please sign in to comment.