///
// Sendet eine Benachrichtigungs-Mail bei neuer Demo-Anfrage
onRecordCreate((e) => {
e.next();
if (e.collection.name !== "inquiries") return;
const r = e.record;
const name = r.getString("name");
const company = r.getString("company");
const email = r.getString("email");
const phone = r.getString("phone");
const message = r.getString("message");
const plan = r.getString("plan");
const subject = `checkflo: Neue Anfrage von ${name}${company ? " (" + company + ")" : ""}`;
const html = `
NEUE DEMO-ANFRAGE
${name}
${company ? `
${company}
` : `
`}
| E-Mail | ${email} |
${phone ? `| Telefon | ${phone} |
` : ""}
${plan ? `| Plan | ${plan} |
` : ""}
${message ? `| Nachricht | ${message} |
` : ""}
`;
try {
const message = new MailerMessage({
from: { address: "hallo@checkflo.de", name: "checkflo" },
to: [{ address: "checkflo@motocamp.de" }],
subject: subject,
html: html,
});
$app.newMailClient().send(message);
} catch (err) {
console.error("Inquiry-Mail Fehler:", err);
}
});