diff --git a/artifacts/api-server/src/routes/contact.ts b/artifacts/api-server/src/routes/contact.ts index 5621daa..8f50978 100644 --- a/artifacts/api-server/src/routes/contact.ts +++ b/artifacts/api-server/src/routes/contact.ts @@ -53,13 +53,7 @@ router.post("/contact", contactRateLimit, async (req, res) => { ] .filter((l) => l !== undefined) .join("\n"), - htmlContent: ` -

Name: ${escapeHtml(name)}

-

E-Mail: ${escapeHtml(email)}

- ${subject ? `

Betreff: ${escapeHtml(subject)}

` : ""} -
-

${escapeHtml(message)}

- `, + htmlContent: buildNotificationEmail({ name, email, subject, message }), }); req.log.info({ to: "jh@unixweb.de", from: email }, "Contact message sent via Brevo"); @@ -103,6 +97,164 @@ function escapeHtml(text: string): string { .replace(/'/g, "'"); } +function buildNotificationEmail({ + name, + email, + subject, + message, +}: { + name: string; + email: string; + subject?: string; + message: string; +}): string { + const safeName = escapeHtml(name); + const safeEmail = escapeHtml(email); + const safeSubject = subject ? escapeHtml(subject) : null; + const safeMessage = escapeHtml(message); + + const brandBlue = "#3f4ff4"; + const textDark = "#0f172a"; + const textMid = "#334155"; + const textMuted = "#64748b"; + const textLight = "#94a3b8"; + const borderColor = "#e2e8f0"; + const bgPage = "#f1f5f9"; + const bgCard = "#ffffff"; + const bgField = "#f8fafc"; + + return ` + + + + + + Neue Kontaktanfrage + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ JH +
+

Joachim Hummel

+
+

Neue Kontaktanfrage

+

Jemand hat das Kontaktformular ausgefüllt.

+ + + + + + + + + + + + ${ + safeSubject + ? ` + + + ` + : "" + } + + + + +
+

Name

+

${safeName}

+
+

E-Mail

+

${safeEmail}

+
+

Betreff

+

${safeSubject}

+
+

Nachricht

+

${safeMessage}

+
+ + + + + + +
+ Absender antworten → +
+
+ + + + +
 
+
+ + + + +
+

Joachim Hummel

+

Webentwicklung & Softwarelösungen

+

+ jh@unixweb.de +  •  + joachim-hummel.de +

+

+ Blog +  •  + n8n Creators +

+
+
+

Diese E-Mail wurde automatisch durch das Kontaktformular generiert.

+
+
+ +`; +} + function buildConfirmationEmail(name: string): string { const safeName = escapeHtml(name); const brandBlue = "#3f4ff4";