From 2f213529455257e0ccfe814612dd0938fac7e6aa Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 1 Apr 2026 11:36:41 +0200 Subject: [PATCH] send-to-list --- usr/bin/send-to-list | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 usr/bin/send-to-list diff --git a/usr/bin/send-to-list b/usr/bin/send-to-list new file mode 100755 index 0000000..1304c43 --- /dev/null +++ b/usr/bin/send-to-list @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +set -euo pipefail + +LIST="$1" +DONE="$2" +EMAIL="$3" +MAX=${4:-1} + +touch "$DONE" +count=0 + +while IFS= read -r line; do + grep -Fxq -- "$line" "$DONE" && continue + + if msmtp "$line" < "$EMAIL"; then + printf '%s\n' "$line" + printf '%s\n' "$line" >> "$DONE" + ((++count >= MAX)) && break + else + echo "FAILED: $line" >&2 + grep -v $line $LIST > tmp + mv tmp $LIST + fi + +done < "$LIST" +