| 16 | export type EmailTemplate = keyof Templates; |
| 17 | |
| 18 | function createSmtpTransport() { |
| 19 | return createTransport({ |
| 20 | host: process.env.SMTP_HOST, |
| 21 | port: process.env.SMTP_PORT ? Number(process.env.SMTP_PORT) : 587, |
| 22 | secure: process.env.SMTP_SECURE === 'true', |
| 23 | auth: |
| 24 | process.env.SMTP_USER && process.env.SMTP_PASS |
| 25 | ? { user: process.env.SMTP_USER, pass: process.env.SMTP_PASS } |
| 26 | : undefined, |
| 27 | connectionTimeout: 10_000, |
| 28 | greetingTimeout: 10_000, |
| 29 | socketTimeout: 30_000, |
| 30 | }); |
| 31 | } |
| 32 | |
| 33 | export async function sendEmail<T extends TemplateKey>( |
| 34 | templateKey: T, |