Surface audit generations on dashboard audits
This commit is contained in:
44
v2_elemente/outreachNode.ts
Normal file
44
v2_elemente/outreachNode.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
"use node";
|
||||
/**
|
||||
* convex/outreachNode.ts
|
||||
*
|
||||
* SMTP-Versand. Eigene Datei mit "use node", weil nodemailer (TCP) im
|
||||
* Standard-Isolate nicht läuft. Dateien mit "use node" dürfen NUR Actions
|
||||
* enthalten — Queries/Mutations bleiben in outreach.ts.
|
||||
*
|
||||
* Voraussetzung: `nodemailer` in package.json.
|
||||
*/
|
||||
import { v } from "convex/values";
|
||||
import { internalAction } from "./_generated/server";
|
||||
import nodemailer from "nodemailer";
|
||||
|
||||
export const sendViaSmtp = internalAction({
|
||||
args: {
|
||||
host: v.string(),
|
||||
port: v.number(),
|
||||
secure: v.boolean(),
|
||||
username: v.string(),
|
||||
password: v.string(), // bereits entschlüsselt vom Orchestrator übergeben
|
||||
fromName: v.string(),
|
||||
fromAddress: v.string(),
|
||||
to: v.string(),
|
||||
subject: v.string(),
|
||||
html: v.string(),
|
||||
text: v.string(),
|
||||
},
|
||||
handler: async (_ctx, a) => {
|
||||
const transport = nodemailer.createTransport({
|
||||
host: a.host,
|
||||
port: a.port,
|
||||
secure: a.secure,
|
||||
auth: { user: a.username, pass: a.password },
|
||||
});
|
||||
await transport.sendMail({
|
||||
from: `"${a.fromName}" <${a.fromAddress}>`,
|
||||
to: a.to,
|
||||
subject: a.subject,
|
||||
text: a.text,
|
||||
html: a.html,
|
||||
});
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user