2
0
Files
bot/packages/emails/src/sendEmail.ts
2023-08-28 09:13:53 +02:00

21 lines
460 B
TypeScript

import { createTransport, SendMailOptions } from 'nodemailer'
import { env } from '@typebot.io/env'
export const sendEmail = (
props: Pick<SendMailOptions, 'to' | 'html' | 'subject'>
) => {
const transporter = createTransport({
host: env.SMTP_HOST,
port: env.SMTP_PORT,
auth: {
user: env.SMTP_USERNAME,
pass: env.SMTP_PASSWORD,
},
})
return transporter.sendMail({
from: env.NEXT_PUBLIC_SMTP_FROM,
...props,
})
}