Changes
This commit is contained in:
30
src/routes/emailAsUser.ts
Normal file
30
src/routes/emailAsUser.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { FastifyInstance } from "fastify";
|
||||
import {createInvoicePDF} from "../utils/pdf";
|
||||
import {useNextNumberRangeNumber} from "../utils/functions";
|
||||
import {sendMailAsUser} from "../utils/emailengine";
|
||||
import {subtle} from "node:crypto";
|
||||
|
||||
export default async function emailAsUserRoutes(server: FastifyInstance) {
|
||||
server.post("/emailasuser/send", async (req, reply) => {
|
||||
const body = req.body as {
|
||||
to: string
|
||||
cc?: string
|
||||
bcc?: string
|
||||
subject?: string
|
||||
text?: string
|
||||
html?: string
|
||||
attachments?: any,
|
||||
account: string
|
||||
}
|
||||
|
||||
try {
|
||||
reply.send(await sendMailAsUser(body.to,body.subject,body.html,body.text,body.account,body.cc,body.bcc,body.attachments))
|
||||
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
reply.code(500).send({ error: "Failed to send E-Mail as User" })
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user