|
@@ -8,6 +8,17 @@ trap cleanup EXIT
|
|
|
|
|
|
cd "${WD}"
|
|
|
|
|
|
+declare -A GROUPALIASES=(
|
|
|
+ ["cropswap@shandan.one"]="Crop Swap Notices"
|
|
|
+ ["cropswap-members@shandan.one"]="Crop Swap Members"
|
|
|
+)
|
|
|
+in_group_aliases(){
|
|
|
+ for key in "${!GROUPALIASES[@]}"; do
|
|
|
+ [ "${key}" == "${1}" ] && return 0
|
|
|
+ done
|
|
|
+ return 1
|
|
|
+}
|
|
|
+CROPSWAPARCHIVE=cropswap-archive@shandan.one
|
|
|
ITER_SUBS=/opt/cropswap/gdbm-iter-subscriptions.py
|
|
|
MIME_INJECT=/opt/cropswap/mime-inject.py
|
|
|
DELIVERED=false
|
|
@@ -34,12 +45,13 @@ reformail \
|
|
|
-U "MIME-Version:" \
|
|
|
-U "Content-Type:" | reformail \
|
|
|
-I "Subject: $(mk_subject)" \
|
|
|
+| if in_group_aliases "${MAILGROUP}"; then reformail \
|
|
|
-I "List-Id: $MAILGROUP" \
|
|
|
-I "List-Unsubscribe: <mailto:$MAILGROUP?subject=[UNSUBSCRIBE]>" \
|
|
|
-I "List-Subscribe: <mailto:$MAILGROUP?subject=[SUBSCRIBE]>" \
|
|
|
-I "List-Post: <mailto:$MAILGROUP>" \
|
|
|
- -I "List-Unsubscribe-Post: List-Unsubscribe=One-Click" \
|
|
|
-| cat - body > mail
|
|
|
+ -I "List-Unsubscribe-Post: List-Unsubscribe=One-Click"
|
|
|
+else cat -; fi | cat - body > mail
|
|
|
|
|
|
declare -A SUBSCRIBED
|
|
|
declare -a actions
|
|
@@ -65,6 +77,10 @@ for email in "${!SUBSCRIBED[@]}"; do
|
|
|
"$SENDMAIL" -F "${FROM}" -f "${MAILGROUP}" "${SUBSCRIBED["$email"]} <${email}>" < mail
|
|
|
DELIVERED=true
|
|
|
done
|
|
|
+if in_group_aliases "${MAILGROUP}"
|
|
|
+then
|
|
|
+ "$SENDMAIL" -F "${FROM}" -f "${MAILGROUP}" "${CROPSWAPARCHIVE}" < mail
|
|
|
+fi
|
|
|
if ! $DELIVERED; then
|
|
|
"$DEBUGMAIL" undelivered
|
|
|
exit "$UNHANDLED"
|