This guide covers essential configuration for self-hosted Postorius (Mailman 3) installations.
Postorius uses PostgreSQL (recommended), MySQL, or SQLite. Configure in settings.py:
# PostgreSQL (recommended)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'mailman',
'USER': 'mailman',
'PASSWORD': 'your-secure-password',
'HOST': 'localhost',
'PORT': '5432',
'CONN_MAX_AGE': 300,
}
}
# MySQL alternative
# 'ENGINE': 'django.db.backends.mysql',
# SQLite (development only)
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': '/opt/mailman/mailmanweb.db',
Configure in settings.py or via environment variables:
# Site URL
ALLOWED_HOSTS = ['lists.example.com', 'localhost']
# Admin credentials (set via environment in production)
MAILMAN_ADMIN_USER = 'admin'
MAILMAN_ADMIN_EMAIL = 'admin@example.com'
# Django security
SECRET_KEY = 'generate-a-unique-secret-key'
DEBUG = False # Always False in production
Generate secret key:
python3 -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())'
Configure Mailman Core connection in settings.py:
MAILMAN_REST_URL = 'http://localhost:8001'
MAILMAN_REST_USER = 'restadmin'
MAILMAN_REST_PASSWORD = 'your-rest-password'
MAILMAN_SITE_LIST = 'mailman' # Default list for new domains
Configure HyperKitty archiver integration:
HYPERKITTY_API_KEY = 'generate-a-random-api-key'
HYPERKITTY_URL = 'http://localhost:8000'
# In Mailman Core config:
# [archiver.hyperkitty]
# class: hyperkitty.plugin.HyperKitty
# configuration:
# url: http://localhost:8000
# api_key: generate-a-random-api-key
Configure Django email backend in settings.py:
# SMTP Configuration
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.yourprovider.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'your-smtp-user'
EMAIL_HOST_PASSWORD = 'your-smtp-password'
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = 'noreply@example.com'
SERVER_EMAIL = 'postmaster@example.com'
Recommended SMTP Providers:
Postorius requires an MTA for email delivery. Configure Postfix:
# /etc/postfix/main.cf
virtual_mailbox_domains = lists.example.com
virtual_mailbox_maps = hash:/etc/postfix/virtual_mailbox_maps
virtual_transport = lmtp:localhost:8024 # Mailman Core LMTP
Generate transport maps:
# Run from Mailman Core container
docker exec mailman-core python manage.py configure_postfix
Configure domains in Postorius admin (Domains > Add Domain):
lists.example.comConfigure mailing list settings (Lists > [List Name] > Settings):
Configure in Lists > [List Name] > Privacy:
Configure SSO/LDAP in settings.py:
# LDAP Authentication
import ldap
from django_auth_ldap.config import LDAPSearch
AUTH_LDAP_SERVER_URI = "ldap://ldap.example.com"
AUTH_LDAP_BIND_DN = "cn=admin,dc=example,dc=com"
AUTH_LDAP_BIND_PASSWORD = "ldap-password"
AUTH_LDAP_USER_SEARCH = LDAPSearch("ou=users,dc=example,dc=com",
ldap.SCOPE_SUBTREE, "(uid=%(user)s)")
SECRET_KEY is unique and securetail -f /var/log/mail.logsettings.pycurl -u restadmin:password http://localhost:8001/3.1/listsHYPERKITTY_API_KEY matches in both servicespython manage.py hyperkitty_rebuild