# Mail-Server Recherche — House of Bots / Privat
*Stand: 2026-06-25*

## Kontext

Diskussion über einen eigenen Mail-Server als Ergänzung zur Matrix-Plattform.
Ziel: Bots bekommen E-Mail-Zugang, privater Betrieb auf K3s.

---

## Protokoll-Übersicht

| Protokoll | Für was | Wer nutzt es |
|---|---|---|
| MAPI | Outlook (Windows/Mac) — vollständiger Exchange-Ersatz | Grommunio |
| ActiveSync (EAS) | iPhone, iPad, Android — echter Push | Mailcow, Grommunio, Carbonio |
| IMAP IDLE | E-Mail-Clients allgemein — quasi-Push | Stalwart, Mailcow, alle |
| JMAP Push | Modern, offen — echter Push ohne ActiveSync | Stalwart |
| CardDAV/CalDAV | Kalender + Kontakte (open standard) | Stalwart, Mailcow |

---

## Lösungsvergleich

| Lösung | iPhone Push | Kalender/Kontakte | IMAP | MAPI | Bemerkung |
|---|---|---|---|---|---|
| Open-Xchange | ✅ ActiveSync | ✅ Ja | ✅ | ⚠️ | Enterprise-tauglich |
| Grommunio | ✅ ActiveSync/MAPI | ✅ Ja | ✅ | ✅ | Exchange-ähnlich, umfassendste OS-Lösung |
| Mailcow | ✅ ActiveSync via SOGo | ✅ Ja | ✅ | ❌ | Sehr beliebt, container-nativ |
| Zimbra | ✅ editionsabhängig | ✅ Ja | ✅ | ⚠️ | Oft ActiveSync |
| Carbonio | ✅ Ja | ✅ Ja | ✅ | ⚠️ | Moderne Groupware |
| Stalwart | ⚠️ IMAP IDLE / JMAP | ⚠️ CardDAV/CalDAV | ✅ | ❌ | Kein vollständiger Exchange-Ersatz |
| Mailu | ⚠️ IMAP IDLE | ⚠️ extern | ✅ | ❌ | Reiner Mailserver |

---

## IMAP — Anbindung für Bots

Alle Lösungen unterstützen IMAP — das ist der universelle Standard.

Für Bot-Zugang ist IMAP ideal:
- Jeder Bot bekommt ein eigenes Postfach
- Bots lesen/senden via IMAP/SMTP
- Keine proprietären Protokolle nötig
- Python/Node.js Bibliotheken vorhanden (imaplib, imap-simple, nodemailer)

Empfohlene Bot-Anbindung:
```
Bot → SMTP (senden) + IMAP (empfangen) → Mailcow oder Grommunio
```

---

## Smart-Host Ansatz (Alternative)

Falls kein eigener vollständiger Mail-Server gewünscht:

```
Bot → eigener Postfix/Maddy (Smart-Host) → Brevo/SendGrid (Relay) → Empfänger
```

Vorteil: Keine Port-25-Probleme, keine IP-Reputationspflege
Nachteil: Kein eigener Empfang, Abhängigkeit von externem Dienst

---

## Push auf iOS — Lösungsweg

```
Eingehende Mail → Mailcow/Grommunio (ActiveSync) → nativer iPhone Push
```

Alternativ ohne ActiveSync:
```
Eingehende Mail → Stalwart → Sieve-Filter → ntfy → APNs → iOS Push
```

---

## Empfehlungen

### Für privaten Betrieb (einfach, solide):
**Mailcow**
- Container-nativ, gut auf K3s portierbar
- ActiveSync = nativer iPhone Push
- SOGo: Webmail + Kalender + Kontakte
- IMAP für Bot-Anbindung ✅
- Sehr aktive Community

### Für Enterprise / Outlook-Kompatibilität:
**Grommunio**
- MAPI (Outlook) + ActiveSync (iOS/Android)
- Vollständiger Exchange-Ersatz
- Komplexer im Betrieb

### Für reine Bot-Nutzung (kein Human-Mailbox):
**Stalwart** oder **Maddy**
- Leichtgewichtig
- IMAP/SMTP für Bot-Zugang reicht
- Kein ActiveSync nötig wenn nur Bots zugreifen

---

## Referenz — Schleswig-Holstein

Land SH setzt Matrix/Element als offiziellen Behörden-Messenger ein.
Starkes Signal für Produktionstauglichkeit von Open-Source-Kommunikationslösungen.

---

## Offene Entscheidung

Mislav hat sich noch nicht entschieden. Offen:
- Outlook-Kompatibilität via MAPI nötig? → Grommunio
- Nur iPhone + Webmail? → Mailcow reicht
- Nur Bot-Zugang via IMAP? → Stalwart/Maddy reicht
- IMAP-Anbindung für Bots gewünscht ✅ (alle Optionen unterstützen das)

---

*Gesichert von kube-bot, 2026-06-25*

---

## IAM-Anbindung — Infisical + LDAP

### Infisical als Secret-Store (bereits im Cluster)

```
Infisical
  └── Secret: bot-argocd/SMTP_PASSWORD
  └── Secret: bot-argocd/IMAP_PASSWORD
  └── Secret: bot-matrix/SMTP_PASSWORD
       ↓
  Bot-Pod (via Infisical Operator / init-container)
       ↓
  Mailcow / Grommunio IMAP/SMTP
```

Vorteil:
- Keine hardcodierten Passwörter in Pods/ConfigMaps
- Credentials zentral rotierbar
- Audit-Log: welcher Bot hat wann auf welches Secret zugegriffen

---

### Braucht man noch LDAP?

Kommt auf die Lösung an:

| Lösung | LDAP nötig? | Alternativ |
|---|---|---|
| Mailcow | Optional — LDAP-Auth möglich, aber nicht zwingend | Lokale Mailcow-User reichen für Bots |
| Grommunio | LDAP empfohlen für User-Sync | Besonders bei vielen Usern |
| Stalwart | LDAP unterstützt, aber optional | Lokale User + Infisical-Secrets reichen |

*Fazit LDAP:*
- Für *reine Bot-Postfächer* → kein LDAP nötig, Infisical-Secrets reichen
- Für *Human-Postfächer + SSO* → LDAP oder OIDC (Keycloak/Authentik) sinnvoll
- Kombination: Infisical für Bot-Secrets, LDAP/OIDC nur für Human-User

---

*Ergänzt 2026-06-25 — Infisical IAM + LDAP-Frage*
