1 {pkgs, lib, config, ...}:
2 let inherit (builtins) attrNames;
3 inherit (config.services) dovecot2;
8 virtualHosts."autoconfig" =
9 let servers = lib.concatMapStringsSep " "
10 (dom: "autoconfig.${dom}")
11 (attrNames dovecot2.domains);
14 serverName = "autoconfig.${config.networking.domain}";
20 root = pkgs.writeTextFile {
22 destination = "/mail/config-v1.1.xml";
25 <clientConfig version="1.1">
26 <emailProvider id="%EMAILDOMAIN%">
27 <!-- <displayName></displayName> -->
28 <!-- <displayShortName></displayShortName> -->
29 <domain>%EMAILDOMAIN%</domain>
30 <incomingServer type="imap">
31 <hostname>mail.%EMAILDOMAIN%</hostname>
33 <socketType>SSL</socketType>
34 <username>%EMAILADDRESS%</username>
35 <authentication>password-cleartext</authentication>
37 <incomingServer type="pop3">
38 <hostname>mail.%EMAILDOMAIN%</hostname>
40 <socketType>SSL</socketType>
41 <username>%EMAILADDRESS%</username>
42 <authentication>password-cleartext</authentication>
44 <leaveMessagesOnServer>false</leaveMessagesOnServer>
45 <downloadOnBiff>true</downloadOnBiff>
48 <outgoingServer type="smtp">
49 <hostname>mail.%EMAILDOMAIN%</hostname>
51 <socketType>SSL</socketType> <!-- see above -->
52 <username>%EMAILADDRESS%</username> <!-- if smtp-auth -->
53 <authentication>password-cleartext</authentication>
54 <!-- <restriction>client-IP-address</restriction> -->
55 <addThisServer>true</addThisServer>
56 <useGlobalPreferredServer>false</useGlobalPreferredServer>
59 <!-- <clientConfigUpdate url="https://www.example.com/config/mozilla.xml" /> -->