Add e-mail system: send applications, receive & reply to responses

Send the complete application (body + generated attachments) to a
user-entered address via authenticated SMTP submission through the
account's own server, so it applies DKIM and uses its reputable IP/PTR —
required for deliverability here (domain publishes SPF -all, DMARC
p=reject). From/Return-Path stay aligned on the sending domain.

Reply e-mails are polled over IMAP, parsed, stored and matched to the
right application (via In-Reply-To/References, then sender address);
their attachments are saved and downloadable. The detail page gains a
correspondence thread with compose, threaded reply, and an AI-drafted
reply the user can edit before sending.

New: lib/mailer.js (nodemailer + imapflow + mailparser), generateEmailReply
in lib/documents.js, emails/email_anhaenge/app_state tables, background
poller + manual fetch. Credentials come from MAIL_* env vars (.env, not
committed / not in the image).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-03 15:59:32 +02:00
co-authored by Claude Opus 4.8
parent 3c553cadf5
commit 0b44f61410
7 changed files with 1289 additions and 4 deletions
+15
View File
@@ -9,3 +9,18 @@ OLLAMA_API_KEY=
# Optional anderer Host (z. B. lokale Ollama-Instanz: http://localhost:11434)
# OLLAMA_HOST=https://ollama.com
# --- E-Mail (SMTP-Versand + IMAP-Empfang) ---
# Versand läuft über die authentifizierte Submission des eigenen Mailservers,
# damit dieser DKIM signiert und die reputable IP/PTR nutzt (SPF/DMARC-Alignment).
# Ohne diese Angaben ist der E-Mail-Teil deaktiviert.
MAIL_HOST=mail.example.com
MAIL_SMTP_PORT=587
MAIL_IMAP_PORT=993
MAIL_USER=name@example.com
MAIL_PASSWORD=
MAIL_FROM_NAME=Vorname Nachname
MAIL_FROM=name@example.com
# IMAP-Postfach + Abrufintervall (ms) für neue Antwortmails
MAIL_IMAP_MAILBOX=INBOX
MAIL_POLL_MS=180000