Installing mlmmj
mlmmj (Mailing List Management Made Joyful) is a simple and lightweight mailing list manager. It is MIT-licensed and written in C. It works with OpenSMTPd and requires no daemons so it can run on very small servers.
Requirements
You will need to configure and test OpenSMTPd.
Install
$ doas pkg_add mlmmj
You can also compile from source.
Documentation
Consult /usr/local/share/doc/mlmmj/README
OpenSMTPd and mlmmj, by default, use the delimiter +. For instance, mlmmj-test+subscribe@example.com accepts request to subscribe to the mlmmj-test email list. No special configuration is required.
To create an initial mailing list, we first create a directory for mlmmj, then run mlmmj-make-ml:
$ doas mkdir /var/spool/mlmmj
$ doas chown _smtpd:_smtpd /var/spool/mlmmj/
$ doas -u _smtpd mlmmj-make-ml
Creating Directorys below /var/spool/mlmmj. Use '-s spooldir' to change
What should the name of the Mailinglist be? [mlmmj-test] :
The Domain for the List? [] : example.com
The emailaddress of the list owner? [postmaster] : postmaster
Replace mlmmj-test and example.com with your real list name and domain.
For each mailing list, add an entry into /etc/mail/virtuals (see aliases(5) and smtpd.conf(5)):
mlmmj-test: "|/usr/local/bin/mlmmj-receive -L /var/spool/mlmmj/mlmmj-test/"
Replace mlmmj-test with your real list name.
Create a log file:
$ doas touch /var/log/mlmmj.log
Then run this command once:
/usr/local/bin/mlmmj-maintd -F -d /var/spool/mlmmj/ >>/var/log/mlmmj.log 2>&1
Then add the task to your crontab:
0 */2 * * * /usr/local/bin/mlmmj-maintd -F -d /var/spool/mlmmj/ >>/var/log/mlmmj.log 2>&1
NOTE: mlmmj sends email from 127.0.0.1, which should be added to /etc/mail/hosts; localhost is not enough.
(:if false:)
Normally the mailing list is only handled on the server, all emails sent to it are for virtual users, or external users. If you have a need to send to a local user, meaning someone with a /home/bangcat directory, you need to modify /etc/mail/smtpd.conf to add a 'table locals file:/etc/mail/locals' and an action to forward email to local users like 'action "local" mbox alias '. The /etc/mail/locals should have a line for each local user that needs to get email.
This is not required in most cases.
(:ifend:)
To sign up to the mailing list, simply email mlmmj-test+subscribe@example.com
Replace mlmmj-test
with your list name, and example.com
with your domain name.
List files are located at /var/spool/mlmmj/<mailing-list-name>
.