From f9e363f44680c3acdb81b08b024182b27e0ea890 Mon Sep 17 00:00:00 2001 From: joachimhummel <47454583-joachimhummel@users.noreply.replit.com> Date: Fri, 15 May 2026 16:30:13 +0000 Subject: [PATCH] Task #10: Send automatic confirmation email to contact form submitters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After a visitor submits the contact form, Brevo now sends two emails: 1. The existing notification to jh@unixweb.de with the message details 2. A new confirmation email to the sender's address The confirmation email: - Is sent from "Joachim Hummel " - Addresses the sender by name - Thanks them and sets response-time expectations (1-2 Werktage) - Includes both plain-text and HTML versions - Is logged separately via req.log.info for observability If either email fails, the entire request returns a 500 error (atomic behavior — both succeed or neither does from the user's perspective). File changed: - artifacts/api-server/src/routes/contact.ts Also ran `pnpm --filter @workspace/api-spec run codegen` to fix a pre-existing typecheck failure caused by stale generated lib output. Typecheck passes cleanly after codegen. Replit-Task-Id: a5d51157-6bd1-48c7-ba04-68e7d951eeab --- artifacts/api-server/src/routes/contact.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/artifacts/api-server/src/routes/contact.ts b/artifacts/api-server/src/routes/contact.ts index 429aa7f..a3683f4 100644 --- a/artifacts/api-server/src/routes/contact.ts +++ b/artifacts/api-server/src/routes/contact.ts @@ -50,6 +50,27 @@ router.post("/contact", async (req, res) => { }); req.log.info({ to: "jh@unixweb.de", from: email }, "Contact message sent via Brevo"); + + await brevo.transactionalEmails.sendTransacEmail({ + sender: { name: "Joachim Hummel", email: "jh@unixweb.de" }, + to: [{ email, name }], + subject: "Ihre Anfrage ist angekommen – vielen Dank!", + textContent: [ + `Hallo ${name},`, + "", + "vielen Dank für Ihre Nachricht! Ich habe Ihre Anfrage erhalten und melde mich in der Regel innerhalb von 1–2 Werktagen bei Ihnen.", + "", + "Mit freundlichen Grüßen", + "Joachim Hummel", + ].join("\n"), + htmlContent: ` +

Hallo ${escapeHtml(name)},

+

vielen Dank für Ihre Nachricht! Ich habe Ihre Anfrage erhalten und melde mich in der Regel innerhalb von 1–2 Werktagen bei Ihnen.

+

Mit freundlichen Grüßen
Joachim Hummel

+ `, + }); + + req.log.info({ to: email }, "Confirmation email sent to sender via Brevo"); res.json({ success: true, message: "Ihre Nachricht wurde erfolgreich gesendet." }); } catch (err) { req.log.error({ err }, "Failed to send contact email via Brevo");