diff --git a/.gitignore b/.gitignore index 6a2ea87..bd4a377 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules/ .env data/*.db +docs/ diff --git a/docs/plans/2026-01-16-mail-service-design.md b/docs/plans/2026-01-16-mail-service-design.md deleted file mode 100644 index 9d30dea..0000000 --- a/docs/plans/2026-01-16-mail-service-design.md +++ /dev/null @@ -1,104 +0,0 @@ -# Mail-Service Design - -**Datum:** 2026-01-16 -**Status:** Genehmigt - -## Übersicht - -Weboberfläche zum Testen des Mail-Versands über Brevo (SMTP). Node.js-basiert mit persistenter Historie. - -## Technologie-Stack - -- **Backend:** Node.js, Express -- **Mail:** Nodemailer -- **Datenbank:** SQLite (better-sqlite3) -- **Frontend:** HTML, CSS, Vanilla JS - -## Projektstruktur - -``` -mail-service/ -├── .env # Konfiguration (SMTP, Port) -├── .env.example # Vorlage ohne sensible Daten -├── package.json -├── src/ -│ ├── server.js # Express-Server, Routen -│ ├── mailer.js # Nodemailer-Konfiguration -│ └── database.js # SQLite-Setup und Queries -├── public/ -│ ├── index.html # Hauptseite mit Formular -│ ├── style.css # Styling -│ └── script.js # Frontend-Logik -└── data/ - └── emails.db # SQLite-Datenbank -``` - -## Datenbank-Schema - -**Tabelle `emails`:** - -| Spalte | Typ | Beschreibung | -|--------|-----|--------------| -| id | INTEGER | Primary Key, Auto-Increment | -| to_email | TEXT | Empfänger-Adresse | -| cc_email | TEXT | CC-Adresse (optional) | -| subject | TEXT | Betreff | -| body | TEXT | Nachrichteninhalt | -| is_html | INTEGER | 0 = Text, 1 = HTML | -| status | TEXT | "success" oder "failed" | -| error_message | TEXT | Fehlermeldung falls fehlgeschlagen | -| created_at | TEXT | ISO-Timestamp | - -## API-Endpunkte - -| Methode | Route | Beschreibung | -|---------|-------|--------------| -| GET | `/` | Weboberfläche (index.html) | -| POST | `/api/send` | Mail versenden | -| GET | `/api/history` | Historie abrufen (letzte 50) | -| DELETE | `/api/history/:id` | Einzelnen Eintrag löschen | -| DELETE | `/api/history` | Gesamte Historie löschen | - -## Weboberfläche - -Zweispaltiges Layout: -- **Links:** Mail-Formular (Empfänger, CC, Betreff, Text/HTML-Toggle, Nachricht) -- **Rechts:** Versand-Historie mit Status-Icons und Lösch-Buttons - -## Fehlerbehandlung - -| Fehlertyp | Behandlung | -|-----------|------------| -| Ungültige E-Mail-Adresse | Validierung Frontend + Backend | -| SMTP-Verbindungsfehler | In DB als "failed" speichern | -| Authentifizierungsfehler | Hinweis auf .env-Konfiguration | -| Timeout | Nach 30 Sekunden Abbruch | -| Leere Pflichtfelder | Frontend verhindert Absenden | - -## Konfiguration (.env) - -```env -# Server -PORT=3000 - -# Email Configuration -MAIL_PROVIDER=smtp -MAIL_FROM_EMAIL=noreply@businesshelpdesk.biz -MAIL_FROM_NAME=Secure Portal - -# SMTP (Brevo) -SMTP_HOST=smtp-relay.brevo.com -SMTP_PORT=587 -SMTP_USER= -SMTP_PASSWORD= -SMTP_SECURE=false -``` - -## Ausführung - -```bash -npm install -npm start -``` - -Server läuft auf http://localhost:3000