Mailman
Mailman is a mailing list management system. It is used in conjunction with a mail server.
Installation
/var/lib/mailman
as state directory and the mailman
user, they currently conflict and can not be installed alongside each other.Mailman can be used in conjunction with Postorius (for configuration) and Hyperkitty (for archiving).
mailman
user, therefore any calls to the mailman
executable have to be done as the mailman
user.Configuration
All configuration for Mailman takes place in /etc/mailman.cfg
. The schema explaining all possible configuration options and setting the defaults is stored in /usr/lib/python3.8/site-packages/mailman/config/schema.cfg
.
The configuration is also accessible via the command line. Run the following command as the mailman
user (e.g. using sudo or su):
[mailman]$ mailman conf
Database
Mailman by default uses an SQLite database in /var/lib/mailman/data/
, but can be configured to use MariaDB or PostgreSQL.
SQLite
The default location for the SQLite database is already reflected in the schema.cfg
and therefore does not have to be set in Mailman's configuration.
/etc/mailman.cfg
[database] url: sqlite:////var/lib/mailman/data/mailman.db
MariaDB
Install the python-pymysql package and configure a database on MariaDB.
/etc/mailman.cfg
[database] class: mailman.database.mysql.MySQLDatabase url: mysql+pymysql://''myuser'':''mypassword''@''mymysqlhost''/mailman?charset=utf8&use_unicode=1
PostgreSQL
Install the python-psycopg2 package and create a database using PostgreSQL.
REST API
Mailman exposes its REST API based on the settings in the section of the configuration. Make sure to replace the default values for and admin_pass
(do not use the example values below).
/etc/mailman.cfg
[webservice] admin_user: my_new_admin_user_name admin_pass: my_new_admin_user_password
ARC
By default DMARC and DKIM are disabled. The configuration takes place in the section of the configuration file. Make sure to set necessary values and read the documentation about the defaults.
MTA
To connect a mail-transfer-agent (MTA), it is necessary to configure the section in the configuration file. Upstream documentation covers examples for postfix, exim and sendmail, but other MTAs are technically possible.
Postfix
To connect to a local postfix instance the following configuration section can be used:
The postfix configuration has to be extended to ensure compatibility (see upstream notes).
Additionally, postfix needs to be made aware of mailman's transport maps. Depending on the postfix configuration these may look similar to the following.
If postmap
is not directly accessible by mailman for creating the default hash-based alias maps, it is possible to generate regular expression based alias maps instead.
To overwrite the default Python-class based configuration, mailman allows the use of a configuration file. Create the following file:
Add the file to the section in mailman's configuration file.
Afterwards the regexp
based exports can then be used in the postfix configuration.
/etc/postfix/main.cf
[..] transport_maps = regexp:/var/lib/mailman/data/postfix_lmtp local_recipient_maps = regexp:/var/lib/mailman/data/postfix_lmtp relay_domains = regexp:/var/lib/mailman/data/postfix_domains [..]
To connect to a local postfix instance with a virtual mail setup, first set an alias domain. Afterwards alter the respective configuration.
Running
Several systemd services with timers exist, taking care of various aspects of the list management:
- : for sending out daily digests to subscribers
- : for hourly polling of NNTP servers for news
- : for sending out daily notifications to admins about pending requests
Setup
Integrate with Hyperkitty
Mailman does not automatically archive mails on its own. The Hyperkitty web application is used for this purpose. Based on a plugin, mailman is able to send mails to a Hyperkitty instance for archival.
Install the package and configure /etc/mailman-hyperkitty.cfg
.
Afterwards, make mailman aware of the plugin:
Tips and tricks
Migrate from mailman < 3.0
Mailman offers the possibility of importing mailman < 3.0 based list databases (). Run the following command as the mailman
user (e.g. using sudo or su):
[mailman]$ mailman import21 LISTSPEC PICKLE_FILE
Here, represents a fully-qualified name of a list to import (e.g. ) and PICKLE_FILE
the path to the list's file.
REST API
Mailman exposes a REST API, which can be interfaced using custom tooling, based on .
See also
- Mailman Documentation - The upstream documentation
- Mailmanclient Documentation - The upstream documentation
- Connecting to Mailman - The upstream documentation on
- Mailman Suite Documentation - The (high level) upstream documentation for the entire Mailman Suite (Mailman, Hyperkitty and Postorius)