autodiscover
This commit is contained in:
@@ -1,8 +1,21 @@
|
||||
# email_autodiscover - Dynamisches Autodiscover/Autoconfig Snippet
|
||||
# Importiert im Caddyfile via: import email_autodiscover
|
||||
#
|
||||
# Funktioniert mit JEDER Domain automatisch, solange der Caddy-Block
|
||||
# auf autodiscover.<domain> oder autoconfig.<domain> hört.
|
||||
#
|
||||
# Hostnames werden dynamisch abgeleitet:
|
||||
# autodiscover.cielectrical.com → imap.cielectrical.com / smtp.cielectrical.com
|
||||
# autoconfig.bayarea-cc.com → imap.bayarea-cc.com / smtp.bayarea-cc.com
|
||||
#
|
||||
# {labels.2}.{labels.1} extrahiert die Basisdomain aus dem Host:
|
||||
# autodiscover.cielectrical.com → labels: [com=0, cielectrical=1, autodiscover=2]
|
||||
# → {labels.1}.{labels.0} = cielectrical.com
|
||||
|
||||
(email_settings) {
|
||||
# 1. Autodiscover für Outlook
|
||||
# 1. Outlook Autodiscover (XML)
|
||||
route /autodiscover/autodiscover.xml {
|
||||
header Content-Type "application/xml"
|
||||
# Wir nutzen {header.X-Anchormailbox} um die Email dynamisch einzufügen
|
||||
respond `<?xml version="1.0" encoding="utf-8"?>
|
||||
<Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006">
|
||||
<Response xmlns="http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a">
|
||||
@@ -11,7 +24,7 @@
|
||||
<Action>settings</Action>
|
||||
<Protocol>
|
||||
<Type>IMAP</Type>
|
||||
<Server>mail.email-srvr.com</Server>
|
||||
<Server>imap.{labels.1}.{labels.0}</Server>
|
||||
<Port>993</Port>
|
||||
<DomainRequired>on</DomainRequired>
|
||||
<LoginName>{header.X-Anchormailbox}</LoginName>
|
||||
@@ -21,17 +34,17 @@
|
||||
</Protocol>
|
||||
<Protocol>
|
||||
<Type>POP3</Type>
|
||||
<Server>mail.email-srvr.com</Server>
|
||||
<Server>pop.{labels.1}.{labels.0}</Server>
|
||||
<Port>995</Port>
|
||||
<DomainRequired>on</DomainRequired>
|
||||
<LoginName>{header.X-Anchormailbox}</LoginName>
|
||||
<SPA>off</SPA>
|
||||
<SSL>on</SSL>
|
||||
<AuthRequired>on</AuthRequired>
|
||||
</Protocol>
|
||||
</Protocol>
|
||||
<Protocol>
|
||||
<Type>SMTP</Type>
|
||||
<Server>mail.email-srvr.com</Server>
|
||||
<Server>smtp.{labels.1}.{labels.0}</Server>
|
||||
<Port>465</Port>
|
||||
<DomainRequired>on</DomainRequired>
|
||||
<LoginName>{header.X-Anchormailbox}</LoginName>
|
||||
@@ -44,31 +57,39 @@
|
||||
</Autodiscover>` 200
|
||||
}
|
||||
|
||||
# 2. JSON Autodiscover (Modern Outlook) - bleibt gleich
|
||||
# 2. Modern Outlook (JSON) - Redirect zum XML Endpoint
|
||||
route /autodiscover/autodiscover.json {
|
||||
header Content-Type "application/json"
|
||||
respond `{
|
||||
"Protocol": "AutodiscoverV1",
|
||||
"Url": "https://autodiscover.bayarea-cc.com/autodiscover/autodiscover.xml"
|
||||
"Url": "https://autodiscover.{labels.1}.{labels.0}/autodiscover/autodiscover.xml"
|
||||
}` 200
|
||||
}
|
||||
|
||||
# 3. Thunderbird Autoconfig - bleibt gleich (dort funktioniert %EMAILADDRESS% ja nativ)
|
||||
# 3. Thunderbird Autoconfig
|
||||
route /mail/config-v1.1.xml {
|
||||
header Content-Type "application/xml"
|
||||
respond `<?xml version="1.0"?>
|
||||
<clientConfig version="1.1">
|
||||
<emailProvider id="email-srvr.com">
|
||||
<displayName>Rackspace Email</displayName>
|
||||
<emailProvider id="{labels.1}.{labels.0}">
|
||||
<displayName>{labels.1}.{labels.0} Mail</displayName>
|
||||
<domain>{labels.1}.{labels.0}</domain>
|
||||
<incomingServer type="imap">
|
||||
<hostname>mail.email-srvr.com</hostname>
|
||||
<hostname>imap.{labels.1}.{labels.0}</hostname>
|
||||
<port>993</port>
|
||||
<socketType>SSL</socketType>
|
||||
<authentication>password-cleartext</authentication>
|
||||
<username>%EMAILADDRESS%</username>
|
||||
</incomingServer>
|
||||
<incomingServer type="pop3">
|
||||
<hostname>pop.{labels.1}.{labels.0}</hostname>
|
||||
<port>995</port>
|
||||
<socketType>SSL</socketType>
|
||||
<authentication>password-cleartext</authentication>
|
||||
<username>%EMAILADDRESS%</username>
|
||||
</incomingServer>
|
||||
<outgoingServer type="smtp">
|
||||
<hostname>mail.email-srvr.com</hostname>
|
||||
<hostname>smtp.{labels.1}.{labels.0}</hostname>
|
||||
<port>465</port>
|
||||
<socketType>SSL</socketType>
|
||||
<authentication>password-cleartext</authentication>
|
||||
@@ -78,20 +99,14 @@
|
||||
</clientConfig>` 200
|
||||
}
|
||||
|
||||
# NEU: Apple MobileConfig Route
|
||||
# Aufrufbar über: /apple?email=kunde@domain.de
|
||||
# 4. Apple MobileConfig
|
||||
route /apple {
|
||||
# KORREKTUR: Wir müssen Caddy sagen, dass er diesen MIME-Type bearbeiten soll!
|
||||
templates {
|
||||
mime "application/x-apple-aspen-config"
|
||||
}
|
||||
|
||||
# Den richtigen MIME-Type setzen
|
||||
header Content-Type "application/x-apple-aspen-config; charset=utf-8"
|
||||
|
||||
# Pfad zur Datei im Container
|
||||
root * /etc/caddy
|
||||
rewrite * /email.mobileconfig.tpl
|
||||
file_server
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user