This page will show you how to install the mlmmj mailing list package on OpenBSD. It covers mostly installation as maintenance and tweaking of how it will work is covered very well in the official documentation at https://mlmmj.org/docs/readme There is nothing special required to get the core package installed in OpenBSD, simply:
$ doas pkg_add mlmmj
The documentation says to make sure you setup a recipient delimiter, which is already at the default of +. This is what is used to separate commands from mailing list identification. For instance, email@example.com is a request to subscribe to the mlmmj-test email list.
In order to start to get the mailing list up and running, we need to create an initial mailing list. The tool mlmmj-make-ml is used to start this process. Running this and all other modifications to your email list must keep _smptd as the owner of all files. This can be be done a few ways:
$ doas -u _smtpd mlmmj-make-ml $ doas -u _smtpd <command to edit files>
You can make your modifications normally, then at the end when you are ready to test them run:
$ doas chown -R _smtpd:_smtpd /var/spool/mlmmj
You can run a shell as the _smtpd user; this should probably only be used when modifying files under your /var/spool/mlmmj/mlmmj-test directory for tweaking of headers and setup of each specific mailing list.
To start, run mlmmj-make-ml and use all default suggestions. Make sure you keep _smtpd as the owner /var/spool/mlmmj directories as stated above.
Now for each mailing list you want, you will need to add an entry into the /etc/mail/aliases file. For more information on this, refer to the opensmtp wiki page.
Each mailing list needs to have email sent to the mlmmj-receive program to properly handle requests. This is accomplished by adding a command like the following into the /etc/mail/aliases file:
mlmmj-test: "|/usr/local/bin/mlmmj-receive -L /var/spool/mlmmj/mlmmj-test/"
A seperate line will be required for each mailing list. Once you have added all the mailing list aliases you need, make sure you run:
$ doas newaliases
That will update the mail system without needing to restart it.
The alias modification is required to send email to the mailing list handling software, however, there is still some other things that need to be done periodically to keep your mailing lists working smoothly. You need to add a task to your crontab that looks like: 0 */2 * * * /bin/sh -c "/usr/local/bin/mlmmj-maintd -F -d /var/spool/mlmmj >>/var/log/mlmmj.log 2>&1" The above is needed, and not like how the documentation shows it. If you don't add the '/bin/sh -c' you will get a weird 'file not found' error in your crontab logs. Use this form of the command so that mlmmj-maintd is run on all mailing lists running. The documentation shows a slightly different syntax that can be used for a specific mailing list, but that is not suggested.
The mlmmj tools send all email from 127.0.0.1, which needs to be explicitly added to the /etc/mail/hosts file, having 'localhost' present is not enough.
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 <locals>'. The /etc/mail/locals should have a line for each local user that needs to get email. This is not required in most cases.
You are now done with the initial setup. You should start back on the official read me file at https://mlmmj.org/docs/readme to fine tune your setup. Although you can sign up people manually with mlmmj-sub, it is better to have the actual users send mail to the mailing list to do that themselves. All the files you need to tweak for an individual list will be located at /var/spool/mlmmj/<mailing-list-name>.