1# Mailman {#module-services-mailman} 2 3[Mailman](https://www.list.org) is free 4software for managing electronic mail discussion and e-newsletter 5lists. Mailman and its web interface can be configured using the 6corresponding NixOS module. Note that this service is best used with 7an existing, securely configured Postfix setup, as it does not automatically configure this. 8 9## Basic usage with Postfix {#module-services-mailman-basic-usage} 10 11For a basic configuration with Postfix as the MTA, the following settings are suggested: 12``` 13{ config, ... }: { 14 services.postfix = { 15 enable = true; 16 relayDomains = ["hash:/var/lib/mailman/data/postfix_domains"]; 17 sslCert = config.security.acme.certs."lists.example.org".directory + "/full.pem"; 18 sslKey = config.security.acme.certs."lists.example.org".directory + "/key.pem"; 19 config = { 20 transport_maps = ["hash:/var/lib/mailman/data/postfix_lmtp"]; 21 local_recipient_maps = ["hash:/var/lib/mailman/data/postfix_lmtp"]; 22 }; 23 }; 24 services.mailman = { 25 enable = true; 26 serve.enable = true; 27 hyperkitty.enable = true; 28 webHosts = ["lists.example.org"]; 29 siteOwner = "mailman@example.org"; 30 }; 31 services.nginx.virtualHosts."lists.example.org".enableACME = true; 32 networking.firewall.allowedTCPPorts = [ 25 80 443 ]; 33} 34``` 35 36DNS records will also be required: 37 38 - `AAAA` and `A` records pointing to the host in question, in order for browsers to be able to discover the address of the web server; 39 - An `MX` record pointing to a domain name at which the host is reachable, in order for other mail servers to be able to deliver emails to the mailing lists it hosts. 40 41After this has been done and appropriate DNS records have been 42set up, the Postorius mailing list manager and the Hyperkitty 43archive browser will be available at 44https://lists.example.org/. Note that this setup is not 45sufficient to deliver emails to most email providers nor to 46avoid spam -- a number of additional measures for authenticating 47incoming and outgoing mails, such as SPF, DMARC and DKIM are 48necessary, but outside the scope of the Mailman module. 49 50## Using with other MTAs {#module-services-mailman-other-mtas} 51 52Mailman also supports other MTA, though with a little bit more configuration. For example, to use Mailman with Exim, you can use the following settings: 53``` 54{ config, ... }: { 55 services = { 56 mailman = { 57 enable = true; 58 siteOwner = "mailman@example.org"; 59 enablePostfix = false; 60 settings.mta = { 61 incoming = "mailman.mta.exim4.LMTP"; 62 outgoing = "mailman.mta.deliver.deliver"; 63 lmtp_host = "localhost"; 64 lmtp_port = "8024"; 65 smtp_host = "localhost"; 66 smtp_port = "25"; 67 configuration = "python:mailman.config.exim4"; 68 }; 69 }; 70 exim = { 71 enable = true; 72 # You can configure Exim in a separate file to reduce configuration.nix clutter 73 config = builtins.readFile ./exim.conf; 74 }; 75 }; 76} 77``` 78 79The exim config needs some special additions to work with Mailman. Currently 80NixOS can't manage Exim config with such granularity. Please refer to 81[Mailman documentation](https://mailman.readthedocs.io/en/latest/src/mailman/docs/mta.html) 82for more info on configuring Mailman for working with Exim.