From 7cbbaedd5ed646ef6fd8df8a3b01d23c9d258a1f Mon Sep 17 00:00:00 2001 From: Andreas Knuth Date: Tue, 27 Jan 2026 09:38:06 -0600 Subject: [PATCH] autodiscover --- caddy/Caddyfile | 54 +------------------------ caddy/email_autodiscover | 86 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+), 53 deletions(-) create mode 100644 caddy/email_autodiscover diff --git a/caddy/Caddyfile b/caddy/Caddyfile index d2f3171..cd465c0 100644 --- a/caddy/Caddyfile +++ b/caddy/Caddyfile @@ -4,6 +4,7 @@ acme_ca https://acme-v02.api.letsencrypt.org/directory debug } +import email_autodiscover # Prod: Neue Domains www.bizmatch.net { handle /pictures/* { @@ -127,17 +128,6 @@ iitwelders.bayarea-cc.com { encode gzip } -s3mail.bayarea-cc.com { - # wenn du API innerhalb von Next bedienst, weiterleiten an den Next Prozess - handle { - reverse_proxy host.docker.internal:3060 - } - log { - output file /var/log/caddy/s3mail.log - format console - } - encode gzip -} www.fancytextstuff.com { redir https://fancytextstuff.com{uri} permanent } @@ -230,45 +220,6 @@ api.email-bayarea.com { encode gzip } -# IMAP/SMTP Server für E-Mail-Clients -email-srvr.com { - # Für E-Mail-Client-Konfiguration (Autodiscover) - handle /.well-known/autoconfig/mail/config-v1.1.xml { - header Content-Type "application/xml" - respond ` - - - andreasknuth.de - Andreas Knuth Mail - AK Mail - - email-srvr.com - 993 - SSL - password-cleartext - %EMAILADDRESS% - - - email-srvr.com - 587 - STARTTLS - password-cleartext - %EMAILADDRESS% - - -` - } - - # Fallback für andere Anfragen - handle { - respond "Mail Server Configuration" 200 - } - - log { - output stderr - format console - } -} annavillesda.org { # API requests to backend handle /api/* { @@ -299,7 +250,4 @@ mail.andreasknuth.de { } web.email-bayarea.com { reverse_proxy nginx-mailcow:8080 -} -mail.email-srvr.com autodiscover.mail.email-srvr.com autoconfig.mail.email-srvr.com { - reverse_proxy nginx-mailcow:8080 } \ No newline at end of file diff --git a/caddy/email_autodiscover b/caddy/email_autodiscover new file mode 100644 index 0000000..aaabea0 --- /dev/null +++ b/caddy/email_autodiscover @@ -0,0 +1,86 @@ +# ------------------------------------------------------------------ +# E-Mail Autodiscover Configuration +# Covers: Outlook (XML & JSON), Thunderbird (Mozilla XML), and generic clients +# ------------------------------------------------------------------ + +# 1. Autodiscover für Outlook & Mobile Clients (Microsoft Standard) +# ------------------------------------------------------------------ +autodiscover.bayarea-cc.com, autodiscover.bizmatch.net { + + # JSON Route (für moderne Outlook Clients / Mobile) + route /autodiscover/autodiscover.json { + header Content-Type "application/json" + respond `{ + "Protocol": "AutodiscoverV1", + "Url": "https://{host}/autodiscover/autodiscover.xml" + }` 200 + } + + # XML Route (Klassisch Outlook) + route /autodiscover/autodiscover.xml { + header Content-Type "application/xml" + respond ` + + + + email + settings + + IMAP + mail.email-srvr.com + 993 + on + on + off + + + SMTP + mail.email-srvr.com + 465 + on + on + off + + + +` 200 + } + + # Fallback für Browser-Tests + route / { + respond "Autodiscover Service for Outlook is running." 200 + } +} + +# 2. Autoconfig für Thunderbird (Mozilla Standard) +# ------------------------------------------------------------------ +autoconfig.bayarea-cc.com, autoconfig.bizmatch.net { + route /mail/config-v1.1.xml { + header Content-Type "application/xml" + respond ` + + + Rackspace Email + + mail.email-srvr.com + 993 + SSL + password-cleartext + %EMAILADDRESS% + + + mail.email-srvr.com + 587 + STARTTLS + password-cleartext + %EMAILADDRESS% + + +` 200 + } + + # Fallback + route / { + respond "Autoconfig Service for Thunderbird is running." 200 + } +} \ No newline at end of file