Small tweaks

This commit is contained in:
Adam Cooper 2024-08-03 11:49:52 -04:00
parent ccc1ff6a21
commit 7e5c97de78

View file

@ -14,8 +14,7 @@ if [[ -z "$(notmuch search tag:misdirected)" ]] ; then
exit 1
fi
# !!! Script just craps out here when invoked with no flag. Refactor to
# match https://www.man7.org/linux/man-pages/man1/getopts.1p.html#EXAMPLES
# Handle option(s)
dry_run=
while getopts n opt ; do
printf "[debug] opt: %s\n\n" $opt
@ -64,8 +63,8 @@ while IFS= read -r -d '' thread ; do
printf "[debug] Outgoing mail:\n%s\n" "$(cat $temporary_file)"
if [[ -z "$dry_run" ]] ; then
echo "[loop] Sending reply to $recipient ... "
cat "$temporary_file" | msmtp --read-envelope-from --read-recipients
cat "$temporary_file" | notmuch insert --folder=Sent -inbox -unread +sent +misdirected-reply
msmtp --read-envelope-from --read-recipients <"$temporary_file"
notmuch insert --folder=Sent -inbox -unread +sent +misdirected-reply <"$temporary_file"
# Remove the misdirected tag
notmuch tag -misdirected -- thread:"$thread_id"