send-to-list

This commit is contained in:
Your Name
2026-04-01 11:36:41 +02:00
parent cbb33df2e3
commit 2f21352945
+26
View File
@@ -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"