mlmpl is a simple mailing list and newsletter manager script. It's meant to be used as mta script.
- p5-DBI
- p5-DBD-SQLite
- p5-Email-Simple
mlmpl
is made by two things:
mda.pl
: this is the MDA (mail delivery agent). Your mail server should call this script and provide three arguments: the receipt, the mailing list address and the sender address.mlmctl.pl
: it's used to create and manage mailing lists.
both will look for /etc/mlmpl/config.pl
(or any other file pointed
by $MLMPL_CONFIG
).
Make sure you have all the dependencies installed, then fetch the code:
git clone https://git.omarpolo.com/mlmpl
Copy config.pl
to /etc/mlmpl/config.pl
, customize the values and initialise the database
sqlite3 /path/to/db.sqlite < schema.sql
Create a mailing list/news letter:
./mlmctl.pl add [email protected] \
name='Example news letter' \
public=false \
archive=true \
moderated=true
The options means:
- public: the outgoing emails use the original address if true, or the default address of the mailing list otherwise
- archive: archive all the message sent
- moderated: only the moderators are allowed to post if true
Add a moderator:
./mlmctl.pl moderator [email protected] [email protected]
To finish, point your mail server to mda.pl
. Done!
To use it with OpenSMTPD you need two tables. Other setups are possible, but this is what I recommend:
- the list of addresses:
# /etc/mail/news-addresses
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
- an alias table so OpenSMTPD can recognise the addresses:
# /etc/mail/news-aliases
news localuser
owner localuser
subscribe localuser
unsubscribe localuser
help localuser
Then you can hook everything together with:
table news file:/etc/mail/news-addresses
table news-aliases file:/etc/mail/news-aliases
action "newsletter" \
mda "/usr/bin/perl /path/mda.pl %{rcpt:lowercase|strip} [email protected] %{sender:lowercase|strip}" \
user "localuser" \
alias <news-aliases>
match from any for rcpt-to <news> action "newsletter"
# "! rcpt-to" so mails for the mailing list don't get matched
match from any for domain <domains> ! rcpt-to <news> action "local_mail"