]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - systems/eldiron/websites/default.nix
Add mail autoconfiguration
[perso/Immae/Config/Nix.git] / systems / eldiron / websites / default.nix
index 68205deebf4ce5b15d6f0e0681fb0708f38b6172..feecc31171ebf6fc2610744a9a1eeebf83e01bdc 100644 (file)
@@ -78,6 +78,75 @@ let
         </Directory>
       '';
     };
+    mail-autoconfig = {
+      extraConfig = let
+        autoconfig = pkgs.writeTextDir "config-v1.1.xml" ''
+          <?xml version="1.0"?>
+          <clientConfig version="1.1">
+            <emailProvider id="mail.immae.eu">
+              <domain>mail.immae.eu</domain>
+              <domain>%EMAILDOMAIN%</domain>
+              <displayName>Immae E-mail</displayName>
+              <displayShortName>Immae E-mail</displayShortName>
+
+              <incomingServer type="imap">
+                <hostname>imap.immae.eu</hostname>
+                <port>143</port>
+                <socketType>STARTTLS</socketType>
+                <username>%EMAILADDRESS%</username>
+                <authentication>password-cleartext</authentication>
+              </incomingServer>
+
+              <incomingServer type="imap">
+                <hostname>imap.immae.eu</hostname>
+                <port>993</port>
+                <socketType>SSL</socketType>
+                <username>%EMAILADDRESS%</username>
+                <authentication>password-cleartext</authentication>
+              </incomingServer>
+
+              <incomingServer type="pop3">
+                <hostname>pop.immae.eu</hostname>
+                <port>110</port>
+                <socketType>STARTTLS</socketType>
+                <username>%EMAILADDRESS%</username>
+                <authentication>password-cleartext</authentication>
+              </incomingServer>
+
+              <incomingServer type="pop3">
+                <hostname>pop.immae.eu</hostname>
+                <port>995</port>
+                <socketType>SSL</socketType>
+                <username>%EMAILADDRESS%</username>
+                <authentication>password-cleartext</authentication>
+              </incomingServer>
+
+              <outgoingServer type="smtp">
+                <hostname>smtp.immae.eu</hostname>
+                <port>587</port>
+                <socketType>STARTTLS</socketType>
+                <username>%EMAILADDRESS%</username>
+                <authentication>password-cleartext</authentication>
+              </outgoingServer>
+
+              <outgoingServer type="smtp">
+                <hostname>smtp.immae.eu</hostname>
+                <port>465</port>
+                <socketType>SSL</socketType>
+                <username>%EMAILADDRESS%</username>
+                <authentication>password-cleartext</authentication>
+              </outgoingServer>
+            </emailProvider>
+          </clientConfig>
+        '';
+      in ''
+        Alias /.well-known/autoconfig/mail "${autoconfig}"
+        <Directory ${autoconfig}>
+          AllowOverride None
+          Require all granted
+        </Directory>
+      '';
+    };
     apaxy = {
       extraConfig = (mypackages-lib.apache-theme { inherit theme_root; }).apacheConfig;
     };