mail.ts uses unified config

This commit is contained in:
cirroskais 2024-04-28 03:41:38 -04:00
parent 21329458e5
commit 9fba6b15e8
No known key found for this signature in database
GPG key ID: 5FC73EBF2678E33D

View file

@ -1,14 +1,16 @@
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,
const { mail } = config
const transport = createTransport({
host: mail.transport.host,
port: mail.transport.port,
secure: mail.transport.secure,
from: mail.send.from,
auth: {
user: process.env.MAIL__USER,
pass: process.env.MAIL__PASS,
user: mail.user,
pass: mail.pass,
},
})
@ -23,7 +25,6 @@ export function sendMail(to: string, subject: string, content: string) {
return transport.sendMail({
to,
subject,
from: mailConfig.send.from,
html: `<span style="font-size:x-large;font-weight:600;">monofile <span style="opacity:0.5">accounts</span></span><br><span style="opacity:0.5">Gain control of your uploads.</span><hr><br>${content
.replaceAll(
"<span username>",