| Total Complexity | 1 |
| Complexity/F | 1 |
| Lines of Code | 25 |
| Function Count | 1 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import { createTransport } from "nodemailer"; |
||
| 2 | import { isProduction } from "./global"; |
||
| 3 | import Email from "email-templates"; |
||
| 4 | import path from "path"; |
||
| 5 | |||
| 6 | export function createEmail(): Email { |
||
| 7 | return new Email({ |
||
| 8 | send: isProduction(), |
||
| 9 | message: { |
||
| 10 | from: process.env.EMAIL_FROM, |
||
| 11 | }, |
||
| 12 | transport: createTransport({ |
||
| 13 | host: process.env.EMAIL_HOST, |
||
| 14 | port: Number(process.env.EMAIL_PORT), |
||
| 15 | auth: { |
||
| 16 | user: process.env.EMAIL_USERNAME, |
||
| 17 | pass: process.env.EMAIL_PASSWORD, |
||
| 18 | }, |
||
| 19 | }), |
||
| 20 | getPath: (type, template) => { |
||
| 21 | return path.join(__dirname, "../emails", template, type); |
||
| 22 | }, |
||
| 23 | }); |
||
| 24 | } |
||
| 25 |