diff options
author | Malfurious <m@lfurio.us> | 2024-07-13 14:47:47 -0400 |
---|---|---|
committer | Malfurious <m@lfurio.us> | 2024-07-13 14:47:47 -0400 |
commit | d2877410fdc9d3a9ff4d83c0066722292696bc6a (patch) | |
tree | 0f3183268e134f397f8f6a14d4a270cb2c4a21ac | |
parent | b995133b274dc14876ecc4ee92d72dbdde85a684 (diff) | |
download | mailnode-d2877410fdc9d3a9ff4d83c0066722292696bc6a.tar.gz mailnode-d2877410fdc9d3a9ff4d83c0066722292696bc6a.zip |
Add mailing list generation script
Create a user mailing list under userconfig with a sane set of initial
configuration variables. Available configuration can be found at
https://mlmmj.org/TUNABLES.html
Signed-off-by: Malfurious <m@lfurio.us>
-rwxr-xr-x | makelist.sh | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/makelist.sh b/makelist.sh new file mode 100755 index 0000000..a1f1566 --- /dev/null +++ b/makelist.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +usage() { + echo "usage: ./makelist.sh <name> <address> <owner>" + echo "" + echo "<name> is the list name, this should be a value suitable for a" + echo "directory name, however '@', '.', and ' ' characters are not allowed." + echo "<address> is the list post address, should be a valid email address." + echo "<owner> is the primary point of contact for the list, should be a" + echo "valid email address." + echo "" + echo "This script must be run from the top-level directory and may fail" + echo "otherwise. This script will also fail if the requested list name" + echo "already exists." + echo "" + echo "On success, mailing list config files are written to:" + echo "userconfig/lists/<name>" + exit 1 +} + +echo "$1" | grep -Eq '^[^/@. ]+$' || usage +echo "$2" | grep -Eq '^[^ ]+@[^ ]+$' || usage +echo "$3" | grep -Eq '^[^ ]+@[^ ]+$' || usage + +listdir="userconfig/lists/$1" +unsub=$(echo "$2" | sed 's/@/+unsubscribe@/g') + +[ -d userconfig/lists ] || usage +[ -d "$listdir" ] && usage +mkdir "$listdir" + +# Default mlmmj list tunables +echo "$2" >"$listdir/listaddress" +echo "$3" >"$listdir/owner" +echo "$3" >"$listdir/moderators" +echo "X-Mailing-List: $2" >>"$listdir/customheaders" +echo "List-Unsubscribe: <mailto:$unsub>" >>"$listdir/customheaders" +touch "$listdir/notifysub" +touch "$listdir/noget" +touch "$listdir/nonomailsub" |