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