From 9fba6b15e81a18b104357b652915a8693d230b3a Mon Sep 17 00:00:00 2001 From: cirroskais Date: Sun, 28 Apr 2024 03:41:38 -0400 Subject: [PATCH] mail.ts uses unified config --- src/server/lib/mail.ts | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/server/lib/mail.ts b/src/server/lib/mail.ts index a10d74a..ee5899f 100644 --- a/src/server/lib/mail.ts +++ b/src/server/lib/mail.ts @@ -1,16 +1,18 @@ import { createTransport } from "nodemailer" -import "dotenv/config" -import config from "../../../config.json" assert { type: "json" } +import config from "./config.js" import { generateFileId } from "./files.js" -let mailConfig = config.mail, - transport = createTransport({ - ...mailConfig.transport, - auth: { - user: process.env.MAIL__USER, - pass: process.env.MAIL__PASS, - }, - }) +const { mail } = config +const transport = createTransport({ + host: mail.transport.host, + port: mail.transport.port, + secure: mail.transport.secure, + from: mail.send.from, + auth: { + user: mail.user, + pass: mail.pass, + }, +}) /** * @description Sends an email @@ -23,7 +25,6 @@ export function sendMail(to: string, subject: string, content: string) { return transport.sendMail({ to, subject, - from: mailConfig.send.from, html: `monofile accounts
Gain control of your uploads.

${content .replaceAll( "",