60 lines
1.1 KiB
Markdown
60 lines
1.1 KiB
Markdown
# Kontaktformular API (minimal)
|
|
|
|
## Endpoint
|
|
|
|
* Methode: POST
|
|
* Pfad: /api/contact
|
|
* Payload: JSON
|
|
|
|
Empfohlene Felder:
|
|
|
|
* name (string, required)
|
|
* email (string, required)
|
|
* company (string, optional)
|
|
* message (string, required)
|
|
* website (string, optional, Honeypot Feld, muss leer bleiben)
|
|
|
|
## Validierung
|
|
|
|
* name: min 2 Zeichen, max 100
|
|
* email: simple RFC-validierung (pragmatisch)
|
|
* message: min 20 Zeichen, max z.B. 4000
|
|
* honeypot: muss leer sein
|
|
|
|
## Anti-Spam / Abuse
|
|
|
|
Minimal und wirksam:
|
|
|
|
* Rate Limit pro IP (z.B. 5 Requests pro 10 Minuten)
|
|
* Logging nur technisch, keine Volltexte im Log (Datenschutz)
|
|
* Generic Error Responses
|
|
|
|
Optional (V2): CAPTCHA nur, wenn Spam real auftritt.
|
|
|
|
## SMTP Versand
|
|
|
|
Nodemailer mit SMTP Settings.
|
|
|
|
Empfohlene Env Vars:
|
|
|
|
* SMTP_HOST
|
|
* SMTP_PORT
|
|
* SMTP_USER
|
|
* SMTP_PASS
|
|
* SMTP_FROM
|
|
* CONTACT_RECIPIENT
|
|
|
|
E-Mail Inhalt:
|
|
|
|
* Subject: Kontaktanfrage von name
|
|
* Reply-To: email
|
|
* Body: Name, Firma, E-Mail, Nachricht, Zeitpunkt, IP anonymisiert (optional)
|
|
|
|
## Responses
|
|
|
|
* 200: Ok (immer gleiche Success Message)
|
|
* 400: Validation Fehler (für UI nutzbar)
|
|
* 429: Rate Limit
|
|
* 500: SMTP/Server Fehler (generic)
|
|
|