From 202de3b954ee46fc5950639891b2d00fbeaa7c16 Mon Sep 17 00:00:00 2001 From: vohoanglong0107 Date: Wed, 1 Mar 2023 09:40:22 +0700 Subject: [PATCH 01/25] switch msmtp log file to XDG_STATE_HOME --- bin/mw | 315 +++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 207 insertions(+), 108 deletions(-) diff --git a/bin/mw b/bin/mw index 2baa5f73..81c75d95 100755 --- a/bin/mw +++ b/bin/mw @@ -9,7 +9,7 @@ cachedir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard" muttrc="${XDG_CONFIG_HOME:-$HOME/.config}/mutt/muttrc" accdir="${XDG_CONFIG_HOME:-$HOME/.config}/mutt/accounts" msmtprc="${XDG_CONFIG_HOME:-$HOME/.config}/msmtp/config" -msmtplog="${XDG_CACHE_HOME:-$HOME/.cache}/msmtp/msmtp.log" +msmtplog="${XDG_STATE_HOME:-$HOME/.local/state}/msmtp/msmtp.log" mbsyncrc="${MBSYNCRC:-$HOME/.mbsyncrc}" mpoprc="${XDG_CONFIG_HOME:-$HOME/.config}/mpop/config" mpoptemp="$muttshare/mpop-temp" @@ -45,54 +45,71 @@ for x in "/etc/ssl/certs/ca-certificates.crt" \ "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem" \ "/usr/local/share/ca-certificates/"; do [ -f "$x" ] && sslcert="$x" && break -done || { echo "CA Certificate not found. Please install one or link it to /etc/ssl/certs/ca-certificates.crt" && exit 1 ;} +done || { echo "CA Certificate not found. Please install one or link it to /etc/ssl/certs/ca-certificates.crt" && exit 1; } -checkbasics() { command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2" +checkbasics() { + command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2" PASSWORD_STORE_DIR="${PASSWORD_STORE_DIR:-$HOME/.password-store}" [ -r "$PASSWORD_STORE_DIR/.gpg-id" ] || { - echo "First run \`pass init \` to set up a password archive." - echo "(If you don't already have a GPG key pair, first run \`$GPG --full-generate-key\`.)" - exit 1 ;} ;} + echo "First run \`pass init \` to set up a password archive." + echo "(If you don't already have a GPG key pair, first run \`$GPG --full-generate-key\`.)" + exit 1 + } +} -getaccounts() { accounts="$(find -L "$accdir" -type f 2>/dev/null | grep -o "\S*.muttrc" | sed "s|.*/\([0-9]-\)*||;s/\.muttrc$//" | nl)" ;} +getaccounts() { accounts="$(find -L "$accdir" -type f 2>/dev/null | grep -o "\S*.muttrc" | sed "s|.*/\([0-9]-\)*||;s/\.muttrc$//" | nl)"; } -list() { getaccounts && [ -n "$accounts" ] && echo "$accounts" || exit 1 ;} +list() { getaccounts && [ -n "$accounts" ] && echo "$accounts" || exit 1; } -prepmsmtp() { mkdir -p "${msmtprc%/*}" "${msmtplog%/*}" ; ln -s "$msmtprc" "$HOME/.msmtprc" 2>/dev/null ; envsubst < "$msmtptemp" >> "$msmtprc" ;} +prepmsmtp() { + mkdir -p "${msmtprc%/*}" "${msmtplog%/*}" + ln -s "$msmtprc" "$HOME/.msmtprc" 2>/dev/null + envsubst <"$msmtptemp" >>"$msmtprc" +} -prepmbsync() { mkdir -p "${mbsyncrc%/*}" ; [ -f "$mbsyncrc" ] && echo >> "$mbsyncrc" ; envsubst < "$mbsynctemp" >> "$mbsyncrc" ;} +prepmbsync() { + mkdir -p "${mbsyncrc%/*}" + [ -f "$mbsyncrc" ] && echo >>"$mbsyncrc" + envsubst <"$mbsynctemp" >>"$mbsyncrc" +} -prepmpop() { mkdir -p "${mpoprc%/*}" ; envsubst < "$mpoptemp" >> "$mpoprc" ;} +prepmpop() { + mkdir -p "${mpoprc%/*}" + envsubst <"$mpoptemp" >>"$mpoprc" +} -prepmutt() { mkdir -p "${muttrc%/*}" "$accdir" - envsubst < "$mutttemp" > "$accdir/$fulladdr.muttrc" - [ ! -f "$muttrc" ] && echo "# vim: filetype=neomuttrc" > "$muttrc" - ! grep -q "^source.*mutt-wizard.muttrc" "$muttrc" && echo "source $muttshare/mutt-wizard.muttrc" >> "$muttrc" - ! grep "^source.*.muttrc" "$muttrc" | grep -qv "$muttshare/mutt-wizard.muttrc" && echo "source $accdir/$fulladdr.muttrc" >> "$muttrc" - echo "macro index,pager i$idnum 'source $accdir/$fulladdr.muttrc!;' \"switch to $fulladdr\"" >> "$muttrc" +prepmutt() { + mkdir -p "${muttrc%/*}" "$accdir" + envsubst <"$mutttemp" >"$accdir/$fulladdr.muttrc" + [ ! -f "$muttrc" ] && echo "# vim: filetype=neomuttrc" >"$muttrc" + ! grep -q "^source.*mutt-wizard.muttrc" "$muttrc" && echo "source $muttshare/mutt-wizard.muttrc" >>"$muttrc" + ! grep "^source.*.muttrc" "$muttrc" | grep -qv "$muttshare/mutt-wizard.muttrc" && echo "source $accdir/$fulladdr.muttrc" >>"$muttrc" + echo "macro index,pager i$idnum 'source $accdir/$fulladdr.muttrc!;' \"switch to $fulladdr\"" >>"$muttrc" } -getprofiles() { \ +getprofiles() { safename="$(echo $fulladdr | sed 's/@/_/g')" case "$type" in - online) - folder="imaps://$login@$imap:$iport" - extra="$(envsubst < "$onlinetemp")" - ;; - pop) prepmpop ;; - *) + online) + folder="imaps://$login@$imap:$iport" + extra="$(envsubst <"$onlinetemp")" + ;; + pop) prepmpop ;; + *) case "$iport" in - 1143) imapssl=None ;; - 143) imapssl=STARTTLS ;; + 1143) imapssl=None ;; + 143) imapssl=STARTTLS ;; esac - prepmbsync ;; + prepmbsync + ;; esac prepmsmtp prepmutt prepnotmuch } -parsedomains(){ serverinfo="$(grep "^${fulladdr#*@}" "$muttshare/domains.csv" 2>/dev/null)" +parsedomains() { + serverinfo="$(grep "^${fulladdr#*@}" "$muttshare/domains.csv" 2>/dev/null)" [ -z "$serverinfo" ] && serverinfo="$(grep "$(echo "${fulladdr#*@}" | sed "s/\.[^\.]*$/\.\\\*/")" "$muttshare/domains.csv" 2>/dev/null)" @@ -105,7 +122,8 @@ EOF iport="${iport:-$iportsugg}" } -delete() { if [ -z "${fulladdr+x}" ]; then +delete() { + if [ -z "${fulladdr+x}" ]; then echo "Select the account you would like to delete (by number):" list || exit 1 read -r input @@ -119,16 +137,20 @@ delete() { if [ -z "${fulladdr+x}" ]; then [ -z "$fulladdr" ] && echo "$fulladdr is not a valid account name." && return 1 - sed -ibu "/IMAPStore $fulladdr-remote$/,/# End profile/d" "$mbsyncrc" 2>/dev/null ; rm -f "$mbsyncrc"bu - rm -rf "${cachedir:?}/${fulladdr:?}" "$accdir/$fulladdr.muttrc" "$accdir/"[0-9]-"$fulladdr.muttrc" - sed -ibu "/\([0-9]-\)\?$fulladdr.muttrc/d" "$muttrc" 2>/dev/null; rm -f "$muttrc"bu - sed -ibu "/account $fulladdr$/,/^\(\s*$\|account\)/d" "$msmtprc" 2>/dev/null; rm -f "$msmtprc"bu - sed -ibu "/account $fulladdr$/,/^\(\s*$\|account\)/d" "$mpoprc" 2>/dev/null; rm -f "$mpoprc"bu + sed -ibu "/IMAPStore $fulladdr-remote$/,/# End profile/d" "$mbsyncrc" 2>/dev/null + rm -f "$mbsyncrc"bu + rm -rf "${cachedir:?}/${fulladdr:?}" "$accdir/$fulladdr.muttrc" "$accdir/"[0-9]-"$fulladdr.muttrc" + sed -ibu "/\([0-9]-\)\?$fulladdr.muttrc/d" "$muttrc" 2>/dev/null + rm -f "$muttrc"bu + sed -ibu "/account $fulladdr$/,/^\(\s*$\|account\)/d" "$msmtprc" 2>/dev/null + rm -f "$msmtprc"bu + sed -ibu "/account $fulladdr$/,/^\(\s*$\|account\)/d" "$mpoprc" 2>/dev/null + rm -f "$mpoprc"bu pass rm -f "$passprefix$fulladdr" >/dev/null 2>&1 [ -n "${purge+x}" ] && safename="$(echo $fulladdr | sed 's/@/_/g')" && rm -rf "${cachedir:?}/${safename:?}" "${maildir:?}/${fulladdr:?}" } -askinfo() { \ +askinfo() { [ -z "$fulladdr" ] && echo "Give the full email address to add:" && read -r fulladdr while ! echo "$fulladdr" | grep -qE "^.+@.+\.[A-Za-z]+$"; do @@ -136,15 +158,16 @@ askinfo() { \ read -r fulladdr done folder="$maildir/$fulladdr" - getaccounts; echo "$accounts" | grep -q "\s$fulladdr$" 2>/dev/null && - { echo "$fulladdr has already been added" && exit 1 ;} - { [ -z "$imap" ] || [ -z "$smtp" ] ;} && parsedomains + getaccounts + echo "$accounts" | grep -q "\s$fulladdr$" 2>/dev/null && + { echo "$fulladdr has already been added" && exit 1; } + { [ -z "$imap" ] || [ -z "$smtp" ]; } && parsedomains [ -z "$imap" ] && echo "Give your email server's IMAP address (excluding the port number):" && read -r imap [ -z "$smtp" ] && echo "Give your email server's SMTP address (excluding the port number):" && read -r smtp case $sport in - 587) tlsline="# tls_starttls" ;; + 587) tlsline="# tls_starttls" ;; esac [ -z "$realname" ] && realname="${fulladdr%%@*}" [ -z "$passprefix" ] && passprefix="" @@ -157,33 +180,38 @@ askinfo() { \ fi } -createpass() { echo "$password" > "$PASSWORD_STORE_DIR/$passprefix$fulladdr" - "$GPG" -qe $(printf -- " -r %s" $(cat "$PASSWORD_STORE_DIR/.gpg-id")) "$PASSWORD_STORE_DIR/$passprefix$fulladdr" +createpass() { + echo "$password" >"$PASSWORD_STORE_DIR/$passprefix$fulladdr" + "$GPG" -qe $(printf -- " -r %s" $(cat "$PASSWORD_STORE_DIR/.gpg-id")) "$PASSWORD_STORE_DIR/$passprefix$fulladdr" case "$(uname)" in - Darwin|*BSD) rm -P "$PASSWORD_STORE_DIR/$passprefix$fulladdr" ;; - *) shred -u "$PASSWORD_STORE_DIR/$passprefix$fulladdr" ;; + Darwin | *BSD) rm -P "$PASSWORD_STORE_DIR/$passprefix$fulladdr" ;; + *) shred -u "$PASSWORD_STORE_DIR/$passprefix$fulladdr" ;; esac - rm -f "$PASSWORD_STORE_DIR/$passprefix$fulladdr" ;} + rm -f "$PASSWORD_STORE_DIR/$passprefix$fulladdr" +} errorexit() { echo "Log-on not successful." case "$imap" in - imap.gmail.com) - echo "This account with $service is using Google's Gmail servers, which disable all third-party applications without an application-specific password. + imap.gmail.com) + echo "This account with $service is using Google's Gmail servers, which disable all third-party applications without an application-specific password. Please be sure you are using OAUTH with your Gmail account, or better yet, stop using Gmail." - ;; - imap.mail.me.com) - echo "This account with $service is using Apple's iCloud servers, which disable all non-Apple applications by default. + ;; + imap.mail.me.com) + echo "This account with $service is using Apple's iCloud servers, which disable all non-Apple applications by default. Please be sure you either enable third-party applications, or create an app-specific password, or best of all, stop using Apple." - ;; + ;; esac exit 1 - } +} -getpass() { while : ; do pass rm -f "$passprefix$fulladdr" >/dev/null 2>&1 - pass insert -f "$passprefix$fulladdr" && break; done ;} +getpass() { while :; do + pass rm -f "$passprefix$fulladdr" >/dev/null 2>&1 + pass insert -f "$passprefix$fulladdr" && break +done; } -getboxes() { if [ -n "${force+x}" ] ; then +getboxes() { + if [ -n "${force+x}" ]; then mailboxes="$(printf "INBOX\\nDrafts\\nJunk\\nTrash\\nSent\\nArchive")" else info="$(curl --location-trusted -s -m 5 --user "$login:$(pass "$passprefix$fulladdr")" --url "${protocol:-imaps}://$imap:${iport:-993}")" @@ -191,45 +219,56 @@ getboxes() { if [ -n "${force+x}" ] ; then mailboxes="$(echo "$info" | grep -v HasChildren | sed "s/.*\" //;s/\"//g" | tr -d '\r')" fi [ "$type" = "pop" ] && mailboxes="INBOX" - for x in $(sed -n "/^macro.* i[0-9] / s/\(^macro.* i\| .*\)//gp " "$muttrc" 2>/dev/null | sort -u; echo 0); do + for x in $( + sed -n "/^macro.* i[0-9] / s/\(^macro.* i\| .*\)//gp " "$muttrc" 2>/dev/null | sort -u + echo 0 + ); do idnum=$((idnum + 1)) [ "$idnum" -eq "$x" ] || break done - toappend="mailboxes $(echo "$mailboxes" | sed "s/^/\"=/;s/$/\"/;s/'/\\\'/g" | paste -sd ' ' - )" + toappend="mailboxes $(echo "$mailboxes" | sed "s/^/\"=/;s/$/\"/;s/'/\\\'/g" | paste -sd ' ' -)" } -finalize() { echo "$toappend" >> "$accdir/$fulladdr.muttrc" +finalize() { + echo "$toappend" >>"$accdir/$fulladdr.muttrc" [ "$type" != "online" ] && echo "$mailboxes" | xargs -I {} mkdir -p "$maildir/$fulladdr/{}/cur" "$maildir/$fulladdr/{}/tmp" "$maildir/$fulladdr/{}/new" mkdir -p "$cachedir/$safename/bodies" echo "$fulladdr (account #$idnum) added successfully." - command -V urlview >/dev/null 2>&1 && [ ! -f "$HOME/.urlview" ] && echo "COMMAND \$BROWSER" > "$HOME/.urlview" - return 0 ;} + command -V urlview >/dev/null 2>&1 && [ ! -f "$HOME/.urlview" ] && echo "COMMAND \$BROWSER" >"$HOME/.urlview" + return 0 +} -prepnotmuch() { \ +prepnotmuch() { [ -z "$NOTMUCH_CONFIG" ] && NOTMUCH_CONFIG="$HOME/.notmuch-config" [ -f "$NOTMUCH_CONFIG" ] && return 0 - envsubst < "$notmuchtemp" > "$NOTMUCH_CONFIG" ;} + envsubst <"$notmuchtemp" >"$NOTMUCH_CONFIG" +} -togglecron() { cron="$(mktemp)" - crontab -l > "$cron" +togglecron() { + cron="$(mktemp)" + crontab -l >"$cron" if grep -q mailsync "$cron"; then echo "Removing automatic mailsync..." - sed -ibu /mailsync/d "$cron"; rm -f "$cron"bu + sed -ibu /mailsync/d "$cron" + rm -f "$cron"bu else echo "Adding automatic mailsync every ${cronmin:-10} minutes..." - echo "*/${cronmin:-10} * * * * $prefix/bin/mailsync" >> "$cron" + echo "*/${cronmin:-10} * * * * $prefix/bin/mailsync" >>"$cron" fi && - crontab "$cron"; rm -f "$cron" ;} + crontab "$cron" + rm -f "$cron" +} setact() { if [ -n "${action+x}" ] && [ "$action" != "$1" ]; then - echo "Running $1 with $action..." - echo "Incompatible options given. Only one action may be specified per run." - exit 1 - else - action="$1" - fi; } + echo "Running $1 with $action..." + echo "Incompatible options given. Only one action may be specified per run." + exit 1 +else + action="$1" +fi; } -mwinfo() { cat << EOF +mwinfo() { + cat < "$tempfile" + echo "# Carefully reorder these accounts with the desired numbers in the first column. +# DO NOT reorder rows or rename the accounts in the second column." >"$tempfile" sed -n " / i[0-9] / s?\(.* i\|'> "$tempfile" + " "$muttrc" >>"$tempfile" ${EDITOR:-vim} "$tempfile" || exit 1 - sed -i -e 's/#.*//' -e '/^$/d' "$tempfile" + sed -i -e 's/#.*//' -e '/^$/d' "$tempfile" default="$(sort -n "$tempfile" | head -n 1)" default="${default#* }" sed -ibu " /.* i[0-9] .*.muttrc/d /^source.*accounts.*.muttrc/d - " "$muttrc" 2>/dev/null; rm -f "$muttrc"bu + " "$muttrc" 2>/dev/null + rm -f "$muttrc"bu awk -v a="$accdir" -v d="$default" ' BEGIN { print "source "a"/"d".muttrc" } { print "macro index,pager i"$1" '\''source "a"/"$2".muttrc!;'\'' \"switch to "$2"\"" } - ' "$tempfile" >> "$muttrc" + ' "$tempfile" >>"$muttrc" } while getopts "rfpXlhodTYD:y:i:I:s:S:u:a:n:P:x:m:t:" o; do case "${o}" in l) setact list ;; r) setact reorder1 ;; d) setact delete ;; - D) setact delete ; fulladdr="$OPTARG" ;; - y) setact sync ; fulladdr="$OPTARG" ;; + D) + setact delete + fulladdr="$OPTARG" + ;; + y) + setact sync + fulladdr="$OPTARG" + ;; Y) setact sync ;; - a) setact add ; fulladdr="$OPTARG" ;; - i) setact add ; imap="$OPTARG" ;; - I) setact add ; iport="$OPTARG" ;; - s) setact add ; smtp="$OPTARG" ;; - S) setact add ; sport="$OPTARG" ;; - u) setact add ; login="$OPTARG" ;; - n) setact add ; realname="$OPTARG" ;; - P) setact add ; passprefix="$OPTARG" ;; - m) setact add ; maxmes="$OPTARG" ;; - o) setact add ; type="online" ;; - p) setact add ; type="pop"; protocol="pop3s" ; iport="${iport:-995}" ;; - f) setact add ; force=True ;; - x) setact add ; password="$OPTARG" ;; - X) setact delete ; purge=True ;; - t) setact toggle ; cronmin="$OPTARG" ;; + a) + setact add + fulladdr="$OPTARG" + ;; + i) + setact add + imap="$OPTARG" + ;; + I) + setact add + iport="$OPTARG" + ;; + s) + setact add + smtp="$OPTARG" + ;; + S) + setact add + sport="$OPTARG" + ;; + u) + setact add + login="$OPTARG" + ;; + n) + setact add + realname="$OPTARG" + ;; + P) + setact add + passprefix="$OPTARG" + ;; + m) + setact add + maxmes="$OPTARG" + ;; + o) + setact add + type="online" + ;; + p) + setact add + type="pop" + protocol="pop3s" + iport="${iport:-995}" + ;; + f) + setact add + force=True + ;; + x) + setact add + password="$OPTARG" + ;; + X) + setact delete + purge=True + ;; + t) + setact toggle + cronmin="$OPTARG" + ;; T) setact toggle ;; h) setact info ;; - \?) echo "See \`$(basename $0) -h\` for possible options and help."; exit 1 ;; -esac done + \?) + echo "See \`$(basename $0) -h\` for possible options and help." + exit 1 + ;; + esac done [ -z "$action" ] && action="info" case "$action" in - list) list ;; - add) checkbasics && askinfo && getboxes && getprofiles && finalize ;; - delete) delete ;; - sync) - echo "\`mw -y\` and \`mw -Y\` are now deprecated and will be removed in a future update. Please switch to using \`mailsync\`." - mailsync $fulladdr - ;; - toggle) togglecron ;; - reorder) reorder ;; - info) mwinfo; exit 1 ;; +list) list ;; +add) checkbasics && askinfo && getboxes && getprofiles && finalize ;; +delete) delete ;; +sync) + echo "\`mw -y\` and \`mw -Y\` are now deprecated and will be removed in a future update. Please switch to using \`mailsync\`." + mailsync $fulladdr + ;; +toggle) togglecron ;; +reorder) reorder ;; +info) + mwinfo + exit 1 + ;; esac From 4eb6e71bd456e9a470d2cf990fba9a104ab5bf8d Mon Sep 17 00:00:00 2001 From: Branislav Gerazov Date: Fri, 14 Apr 2023 21:43:29 +0200 Subject: [PATCH 02/25] add highlighting for flagged emails --- share/mutt-wizard.muttrc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/share/mutt-wizard.muttrc b/share/mutt-wizard.muttrc index 47d48c3a..fdb94d82 100644 --- a/share/mutt-wizard.muttrc +++ b/share/mutt-wizard.muttrc @@ -133,6 +133,11 @@ color index brightyellow blue "~T" color index_author brightred blue "~T" color index_subject brightcyan blue "~T" +# Flagged mail is highlighted: +color index brightgreen default "~F" +color index_subject brightgreen default "~F" +color index_author brightgreen default "~F" + # Other colors and aesthetic settings: mono bold bold mono underline underline From abec887fc202f586139c23bfe82b76ac7fc750d5 Mon Sep 17 00:00:00 2001 From: Branislav Gerazov Date: Fri, 14 Apr 2023 21:58:40 +0200 Subject: [PATCH 03/25] forward email body as text --- share/mutt-wizard.muttrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/share/mutt-wizard.muttrc b/share/mutt-wizard.muttrc index 47d48c3a..dd975837 100644 --- a/share/mutt-wizard.muttrc +++ b/share/mutt-wizard.muttrc @@ -15,7 +15,8 @@ set rfc2047_parameters = yes set sleep_time = 0 # Pause 0 seconds for informational messages set markers = no # Disables the `+` displayed at line wraps set mark_old = no # Unread mail stay unread until read -set mime_forward = yes # attachments are forwarded with mail +set mime_forward = no # mail body is forwarded as text +set forward_attachments = yes # attachments are forwarded with mail set wait_key = no # mutt won't ask "press key to continue" set fast_reply # skip to compose when replying set fcc_attach # save attachments with the body From 6c13d3213a22ef74e71941aba44507e072078e1e Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 11 May 2023 10:28:20 -0400 Subject: [PATCH 04/25] fix #935 --- share/mutt-wizard.muttrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/mutt-wizard.muttrc b/share/mutt-wizard.muttrc index 47d48c3a..2acaca1c 100644 --- a/share/mutt-wizard.muttrc +++ b/share/mutt-wizard.muttrc @@ -99,7 +99,7 @@ macro index \eh "$prefix/libexec/gpg-wks-client --receive | msmtp macro index,pager a "set my_pipe_decode=\$pipe_decode pipe_decodeabook --add-emailset pipe_decode=\$my_pipe_decode; unset my_pipe_decode" "add the sender address to abook" macro index \Cr "T~UN." "mark all messages as read" -macro index O "mw -Y" "run mw -Y to sync all mail" +macro index O "mailsync" "run mailsync to sync all mail" macro index \Cf "unset wait_keyprintf 'Enter a search term to find with notmuch: '; read x; echo \$x >~/.cache/mutt_terms~i \"\`notmuch search --output=messages \$(cat ~/.cache/mutt_terms) | head -n 600 | perl -le '@a=<>;s/\^id:// for@a;$,=\"|\";print@a' | perl -le '@a=<>; chomp@a; s/\\+/\\\\+/ for@a;print@a' \`\"" "show only messages matching a notmuch pattern" macro index A "all\n" "show all messages (undo limit)" From 4bda328ecc30dedfb08f9f238ba37837ae4c7fa4 Mon Sep 17 00:00:00 2001 From: "Gunnar K. Halvorsen" Date: Fri, 12 May 2023 21:20:07 +0000 Subject: [PATCH 05/25] Update domains.csv --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index eaa0be17..950e35de 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -53,6 +53,7 @@ carleton.ca,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 cash4u.com,imap.mail.com,993,smtp.mail.com,587 cedars.xyz,mail.cedars.xyz,993,mail.cedars.xyz,465 ceng.metu.edu.tr,imap.ceng.metu.edu.tr,993,mailhost.ceng.metu.edu.tr,587 +cerex.no,mail.cerex.no,993,mail.cerex.no,465 cheerful.com,imap.mail.com,993,smtp.mail.com,587 chef.net,imap.mail.com,993,smtp.mail.com,587 chemist.com,imap.mail.com,993,smtp.mail.com,587 From 64454c2d4d8b8e773f14655b446c248426e2837d Mon Sep 17 00:00:00 2001 From: Satya Benson Date: Mon, 15 May 2023 18:18:29 -0400 Subject: [PATCH 06/25] fix typo in set crypt_auto_sign --- share/mutt-wizard.muttrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/mutt-wizard.muttrc b/share/mutt-wizard.muttrc index 316a572a..95a9ae9d 100644 --- a/share/mutt-wizard.muttrc +++ b/share/mutt-wizard.muttrc @@ -91,7 +91,7 @@ macro index,pager ga "=Archive" "go to archive" macro index,pager Ma ";=Archive" "move mail to archive" macro index,pager Ca ";=Archive" "copy mail to archive" -#set crypt_autosign = yes +#set crypt_auto_sign = yes #set crypt_opportunistic_encrypt = yes #set pgp_self_encrypt = yes #set pgp_default_key = 'your@gpgemailaddre.ss' From 4ef696446ca62c13dd95e07ebb0ea2f6cb3425f7 Mon Sep 17 00:00:00 2001 From: "Gunnar K. Halvorsen" Date: Fri, 26 May 2023 17:07:10 +0200 Subject: [PATCH 07/25] Update domains.csv --- share/domains.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/domains.csv b/share/domains.csv index 950e35de..1e0e87c7 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -118,7 +118,7 @@ fsmpi.rwth-aachen.de,mail.fsmpi.rwth-aachen.de,993,mail.fsmpi.rwth-aachen.de,465 fsu-jena,exchange.uni-jena.de,993,smtp.uni-jena.de,587 gcc.edu,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 getbackinthe.kitchen,mail.cock.li,993,mail.cock.li,587 -ghalv.no,mail.ghalv.no,993,mail.ghalv.no,587 +ghalv.no,mail.ghalv.no,993,mail.ghalv.no,465 gmail.com,imap.gmail.com,993,smtp.gmail.com,587 gmx.*,imap.gmx.net,993,mail.gmx.net,587 go2.pl,poczta.o2.pl,993,poczta.o2.pl,465 From f3c2d88e55822d2794d3f1105182c1e670d016ae Mon Sep 17 00:00:00 2001 From: vlashada <79418781+vlashada@users.noreply.github.com> Date: Tue, 30 May 2023 18:57:36 +0200 Subject: [PATCH 08/25] Update domains.csv --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index 950e35de..36299d3e 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -89,6 +89,7 @@ diplomats.com,imap.mail.com,993,smtp.mail.com,587 dismail.de,imap.dismail.de,993,smtp.dismail.de,465 disroot.org,disroot.org,993,disroot.org,587 distruzione.org,mail.autistici.org,993,smtp.autistici.org,465 +domeneshop.no,imap.domeneshop.no,993,smtp.domeneshop.no,587 dorriseaton.com,outlook.office365.com,993,smtp.office365.com,587 dr.com,imap.mail.com,993,smtp.mail.com,587 duke.edu,outlook.office365.com,993,smtp.office365.com,587 From e0dd9f8193a9a3c38a867eeb3f3f18c4c170d8df Mon Sep 17 00:00:00 2001 From: speedie <71722170+speediegq@users.noreply.github.com> Date: Tue, 20 Jun 2023 19:52:33 +0200 Subject: [PATCH 09/25] Add gettext dependency to README gettext which provides the envsubst command is not installed on all distributions. Void for instance does not come with this, so I think it should be mentioned in the README. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 58830149..76e2461e 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ Specifically, this wizard: - `msmtp` - sends the email. - `pass` - safely encrypts passwords (required at install). - `ca-certificates` - required for SSL. Probably installed already. +- `gettext` - writes config files. Probably installed already. **Note**: There's a chance of errors if you use a slow-release distro like Ubuntu, Debian, or Mint. If you get errors in `neomutt`, install the most From e894c486c090968d324b8ab1ff98dee4626a2aaf Mon Sep 17 00:00:00 2001 From: Aisha Tammy Date: Sun, 16 Jul 2023 11:09:10 -0400 Subject: [PATCH 10/25] exclude dovecot special folders fts-flatcurve/virtual --- share/mbsync-temp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/mbsync-temp b/share/mbsync-temp index 46cd51bb..4e77b093 100644 --- a/share/mbsync-temp +++ b/share/mbsync-temp @@ -16,7 +16,7 @@ Channel $fulladdr Expunge Both $master :$fulladdr-remote: $slave :$fulladdr-local: -Patterns * !"[Gmail]/All Mail" +Patterns * !"[Gmail]/All Mail" !"*fts-flatcurve*" !"*virtual*" Create Both SyncState * MaxMessages $maxmes From 268da5d51b1e710f244507296f911cd847fb8dbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Faikl=20=28astro=29?= Date: Wed, 26 Jul 2023 01:38:52 +0200 Subject: [PATCH 11/25] pipe password directly to pass - also change slightly confusing naming for (re)inserting given passwords to pass store --- bin/mw | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/bin/mw b/bin/mw index 81c75d95..eaec3a9a 100755 --- a/bin/mw +++ b/bin/mw @@ -174,20 +174,14 @@ askinfo() { hostname="${fulladdr#*@}" login="${login:-$fulladdr}" if [ -n "${password+x}" ]; then - createpass + insertpass else getpass fi } -createpass() { - echo "$password" >"$PASSWORD_STORE_DIR/$passprefix$fulladdr" - "$GPG" -qe $(printf -- " -r %s" $(cat "$PASSWORD_STORE_DIR/.gpg-id")) "$PASSWORD_STORE_DIR/$passprefix$fulladdr" - case "$(uname)" in - Darwin | *BSD) rm -P "$PASSWORD_STORE_DIR/$passprefix$fulladdr" ;; - *) shred -u "$PASSWORD_STORE_DIR/$passprefix$fulladdr" ;; - esac - rm -f "$PASSWORD_STORE_DIR/$passprefix$fulladdr" +insertpass() { + printf "%s" "$password" | pass insert -fe "$PASSWORD_STORE_DIR/$passprefix$fulladdr" } errorexit() { From 8d78212cad1fa48d7918d0130905d3a0c6c254f3 Mon Sep 17 00:00:00 2001 From: Jonas Dujava Date: Fri, 11 Aug 2023 18:53:30 +0200 Subject: [PATCH 12/25] fix: reorder action --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mw b/bin/mw index 81c75d95..2a633151 100755 --- a/bin/mw +++ b/bin/mw @@ -328,7 +328,7 @@ reorder() { while getopts "rfpXlhodTYD:y:i:I:s:S:u:a:n:P:x:m:t:" o; do case "${o}" in l) setact list ;; - r) setact reorder1 ;; + r) setact reorder ;; d) setact delete ;; D) setact delete From b1af6ad2aa8a3900a66998fc64929eb15603d461 Mon Sep 17 00:00:00 2001 From: Ashish Panigrahi Date: Thu, 12 Oct 2023 17:35:54 +0200 Subject: [PATCH 13/25] fixed domain for niser.ac.in --- share/domains.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/domains.csv b/share/domains.csv index 835d96c5..cf0726e9 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -200,7 +200,7 @@ national.shitposting.agency,mail.cock.li,993,mail.cock.li,587 ncsu.edu,imap.gmail.com,993,smtp.gmail.com,587 netcourrier.com,mail.netcourrier.com,993,mail.netcourrier.com,465 nigge.rs,mail.cock.li,993,mail.cock.li,587 -niser.ac.in,imap.gmail.com,993,smtp.gmail.com,587 +niser.ac.in,imap.gmail.com,993,smtp.gmail.com,465 nixnet.email,imap.nixnet.email,143,smtp.nixnet.email,587 nixnet.xyz,imap.nixnet.email,143,smtp.nixnet.email,587 nixnetmail.com,imap.nixnet.email,143,smtp.nixnet.email,587 From 97f58830175b1fa9180dfc318c99d225ce672dd1 Mon Sep 17 00:00:00 2001 From: Ashish Panigrahi Date: Thu, 12 Oct 2023 17:38:34 +0200 Subject: [PATCH 14/25] added `fz-juelich.de` into domain list --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index cf0726e9..beb7a1e6 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -117,6 +117,7 @@ freedom.nl,imap.freedom.nl,993,smtp.freedom.nl,465 freedom.xyz,imap.nixnet.email,143,smtp.nixnet.email,587 fsmpi.rwth-aachen.de,mail.fsmpi.rwth-aachen.de,993,mail.fsmpi.rwth-aachen.de,465 fsu-jena,exchange.uni-jena.de,993,smtp.uni-jena.de,587 +fz-juelich.de,imap.fz-juelich.de,993,mail.fz-juelich.de,587 gcc.edu,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 getbackinthe.kitchen,mail.cock.li,993,mail.cock.li,587 ghalv.no,mail.ghalv.no,993,mail.ghalv.no,465 From 532332b8df5dba470bfe96f95592153e303cefa3 Mon Sep 17 00:00:00 2001 From: appeasementPolitik <108810900+appeasementPolitik@users.noreply.github.com> Date: Wed, 15 Nov 2023 18:39:23 +0000 Subject: [PATCH 15/25] Fix notify-send not coming through --- bin/mailsync | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/mailsync b/bin/mailsync index cbd36ff9..1d403d6a 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -63,11 +63,11 @@ syncandnotify() { newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l) case 1 in $((newcount > 5)) ) - echo "$newcount new mail for $2." + echo "$newcount new mail for $2." >/dev/tty [ -z "$MAILSYNC_MUTE" ] && notify "New Mail!" "📬 $newcount new mail(s) in \`$2\` account." ;; $((newcount > 0)) ) - echo "$newcount new mail for $2." + echo "$newcount new mail for $2." >/dev/tty [ -z "$MAILSYNC_MUTE" ] && for file in $new; do # Extract and decode subject and sender from mail. From 0cb17135b9ed52c89f20e671b03decd94ab7b2fe Mon Sep 17 00:00:00 2001 From: burbschat Date: Fri, 24 Nov 2023 21:39:31 +0100 Subject: [PATCH 16/25] Fix escaping in message IDs from notmuch `+` was properly escaped but only once. `$` was not escaped at all. This would result in messages with message IDs containing more than one `+` or at least on `$` to not be shown after limiting. `$` itself has to be escaped presumably for the shell. This results in three prepended backslashes in the limit string and six in the config file, as there backslashes themselves have to be escaped. --- share/mutt-wizard.muttrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/mutt-wizard.muttrc b/share/mutt-wizard.muttrc index 95a9ae9d..27ae2168 100644 --- a/share/mutt-wizard.muttrc +++ b/share/mutt-wizard.muttrc @@ -101,7 +101,7 @@ macro index \eh "$prefix/libexec/gpg-wks-client --receive | msmtp macro index,pager a "set my_pipe_decode=\$pipe_decode pipe_decodeabook --add-emailset pipe_decode=\$my_pipe_decode; unset my_pipe_decode" "add the sender address to abook" macro index \Cr "T~UN." "mark all messages as read" macro index O "mailsync" "run mailsync to sync all mail" -macro index \Cf "unset wait_keyprintf 'Enter a search term to find with notmuch: '; read x; echo \$x >~/.cache/mutt_terms~i \"\`notmuch search --output=messages \$(cat ~/.cache/mutt_terms) | head -n 600 | perl -le '@a=<>;s/\^id:// for@a;$,=\"|\";print@a' | perl -le '@a=<>; chomp@a; s/\\+/\\\\+/ for@a;print@a' \`\"" "show only messages matching a notmuch pattern" +macro index \Cf "unset wait_keyprintf 'Enter a search term to find with notmuch: '; read x; echo \$x >~/.cache/mutt_terms~i \"\`notmuch search --output=messages \$(cat ~/.cache/mutt_terms) | head -n 600 | perl -le '@a=<>;s/\^id:// for@a;$,=\"|\";print@a' | perl -le '@a=<>; chomp@a; s/\\+/\\\\+/g for@a; s/\\$/\\\\\\$/g for@a;print@a' \`\"" "show only messages matching a notmuch pattern" macro index A "all\n" "show all messages (undo limit)" # Sidebar mappings From 32b5e833159ce2041e2f5c62dd36df7a3e370282 Mon Sep 17 00:00:00 2001 From: Jonas Dujava Date: Sun, 3 Dec 2023 13:39:12 +0100 Subject: [PATCH 17/25] fix: rename variables According to: https://neomutt.org/guide/reference.html#3-380-%C2%A0realname https://neomutt.org/guide/reference.html#3-480-%C2%A0spoolfile --- share/mutt-temp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/mutt-temp b/share/mutt-temp index 81148a11..63841adb 100644 --- a/share/mutt-temp +++ b/share/mutt-temp @@ -1,6 +1,6 @@ # vim: filetype=neomuttrc # muttrc file for account $fulladdr -set realname = "$realname" +set real_name = "$realname" set from = "$fulladdr" set sendmail = "msmtp -a $fulladdr" alias me $realname <$fulladdr> @@ -10,7 +10,7 @@ set message_cachedir = "$cachedir/$safename/bodies" set mbox_type = Maildir set hostname = "$hostname" source $muttshare/switch.muttrc -set spoolfile = "+INBOX" +set spool_file = "+INBOX" set postponed = "+Drafts" set trash = "+Trash" set record = "+Sent" From 77647d101d445331cdf0544ec18f4517031993d2 Mon Sep 17 00:00:00 2001 From: Randy Palamar Date: Thu, 28 Dec 2023 13:00:01 -0700 Subject: [PATCH 18/25] cleanup Makefile * OS variable was unused * ifndef section is not needed since "make PREFIX=... MANPREFIX=..." overwrites whatever is set there * notdir is a GNU specific function (not POSIX) and doesn't do anything in this case * "sed -i" is not POSIX and pointless if pipes are used correctly * the "if" block can be removed since "sed" can also be used to copy files to the destination. --- Makefile | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index a1504476..623aaf71 100644 --- a/Makefile +++ b/Makefile @@ -1,39 +1,27 @@ .POSIX: -OS = $(shell uname -s) -ifndef PREFIX - PREFIX = /usr/local -endif -ifndef MANPREFIX - MANPREFIX = $(PREFIX)/share/man -endif +PREFIX = /usr/local +MANPREFIX = $(PREFIX)/share/man install: mkdir -p $(DESTDIR)$(PREFIX)/bin mkdir -p $(DESTDIR)$(PREFIX)/lib/mutt-wizard - cp -f bin/mw bin/mailsync $(DESTDIR)$(PREFIX)/bin/ - cp -f lib/openfile $(DESTDIR)$(PREFIX)/lib/mutt-wizard - chmod 755 $(DESTDIR)$(PREFIX)/bin/mw $(DESTDIR)$(PREFIX)/bin/mailsync $(DESTDIR)$(PREFIX)/lib/mutt-wizard/openfile mkdir -p $(DESTDIR)$(PREFIX)/share/mutt-wizard + cp -f bin/mailsync $(DESTDIR)$(PREFIX)/bin + cp -f lib/openfile $(DESTDIR)$(PREFIX)/lib/mutt-wizard chmod 755 $(DESTDIR)$(PREFIX)/share/mutt-wizard for shared in share/*; do \ cp -f $$shared $(DESTDIR)$(PREFIX)/share/mutt-wizard; \ chmod 644 $(DESTDIR)$(PREFIX)/share/mutt-wizard/$$(basename $(notdir $$shared)); \ done mkdir -p $(DESTDIR)$(MANPREFIX)/man1 - cp -f mw.1 $(DESTDIR)$(MANPREFIX)/man1/mw.1 cp -f mailsync.1 $(DESTDIR)$(MANPREFIX)/man1/mailsync.1 + sed 's:/usr/local:$(PREFIX):' < share/mutt-wizard.muttrc > $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrc + sed 's:/usr/local:$(PREFIX):' < share/mailcap > $(DESTDIR)$(PREFIX)/share/mutt-wizard/mailcap + sed 's:/usr/local:$(PREFIX):' < bin/mw > $(DESTDIR)$(PREFIX)/bin/mw + sed 's:/usr/local:$(PREFIX):' < mw.1 > $(DESTDIR)$(MANPREFIX)/man1/mw.1 chmod 644 $(DESTDIR)$(MANPREFIX)/man1/mw.1 $(DESTDIR)$(MANPREFIX)/man1/mailsync.1 - if [ "$(PREFIX)" ]; then \ - sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrc; \ - rm -f $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrcba; \ - sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(PREFIX)/bin/mw; \ - rm -f $(DESTDIR)$(PREFIX)/bin/mwba; \ - sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(MANPREFIX)/man1/mw.1; \ - rm -f $(DESTDIR)$(MANPREFIX)/man1/mw.1ba; \ - sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(PREFIX)/share/mutt-wizard/mailcap; \ - rm -f $(DESTDIR)$(PREFIX)/share/mutt-wizard/mailcapba; \ - fi + chmod 755 $(DESTDIR)$(PREFIX)/bin/mw $(DESTDIR)$(PREFIX)/bin/mailsync $(DESTDIR)$(PREFIX)/lib/mutt-wizard/openfile mkdir -p $(DESTDIR)$(PREFIX)/share/zsh/site-functions/ chmod 755 $(DESTDIR)$(PREFIX)/share/zsh/site-functions/ cp -f completion/_mutt-wizard.zsh $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_mutt-wizard.zsh From 11e54213dd16fb3b39be934ce0d465483ddfed80 Mon Sep 17 00:00:00 2001 From: speedie Date: Mon, 18 Mar 2024 17:48:15 +0100 Subject: [PATCH 19/25] Don't prompt for password, if the email address already has a saved password. This is useful if you copy your .password-store directory from one computer to another. --- bin/mw | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/mw b/bin/mw index cdb78560..44086be4 100755 --- a/bin/mw +++ b/bin/mw @@ -173,11 +173,11 @@ askinfo() { [ -z "$passprefix" ] && passprefix="" hostname="${fulladdr#*@}" login="${login:-$fulladdr}" - if [ -n "${password+x}" ]; then + if [ -n "${password+x}" ] && [ ! -f "$PASSWORD_STORE_DIR/$passprefix$fulladdr.gpg" ]; then insertpass - else + elif [ ! -f "$PASSWORD_STORE_DIR/$passprefix$fulladdr.gpg" ]; then getpass - fi + fi } insertpass() { From 1d89388a0e6c83f6ac0ca103ff2890e807fa3b0e Mon Sep 17 00:00:00 2001 From: Karim Hussein Date: Wed, 22 May 2024 09:17:38 +0300 Subject: [PATCH 20/25] Added direct link to Google App Password page for easier access --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 76e2461e..07995cff 100644 --- a/README.md +++ b/README.md @@ -209,6 +209,8 @@ To give you an example of the interface, here's an idea: applications requires turning off two-factor authentication and this will circumvent that. You might also need to manually "Enable IMAP" in the settings. + To create an App Password for your Google account, + you can directly visit the [App Passwords](https://myaccount.google.com/apppasswords) page in your Google Account settings. - If you have a university email or enterprise-hosted email for work, there might be other hurdles or two-factor authentication you have to jump through. Some, for example, will want you to create a separate IMAP password, etc. From 86a1f1d66fb463a8745c3957d8a47037ac9e6ff6 Mon Sep 17 00:00:00 2001 From: Yaroslav Chvanov Date: Wed, 14 Aug 2024 18:54:04 +0300 Subject: [PATCH 21/25] muttrc: use XDG_CACHE_HOME in notmuch integration Fixes `sh: 1: cannot create /home//.cache/mutt_terms: Directory nonexistent`. --- share/mutt-wizard.muttrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/mutt-wizard.muttrc b/share/mutt-wizard.muttrc index 27ae2168..f236bc43 100644 --- a/share/mutt-wizard.muttrc +++ b/share/mutt-wizard.muttrc @@ -101,7 +101,7 @@ macro index \eh "$prefix/libexec/gpg-wks-client --receive | msmtp macro index,pager a "set my_pipe_decode=\$pipe_decode pipe_decodeabook --add-emailset pipe_decode=\$my_pipe_decode; unset my_pipe_decode" "add the sender address to abook" macro index \Cr "T~UN." "mark all messages as read" macro index O "mailsync" "run mailsync to sync all mail" -macro index \Cf "unset wait_keyprintf 'Enter a search term to find with notmuch: '; read x; echo \$x >~/.cache/mutt_terms~i \"\`notmuch search --output=messages \$(cat ~/.cache/mutt_terms) | head -n 600 | perl -le '@a=<>;s/\^id:// for@a;$,=\"|\";print@a' | perl -le '@a=<>; chomp@a; s/\\+/\\\\+/g for@a; s/\\$/\\\\\\$/g for@a;print@a' \`\"" "show only messages matching a notmuch pattern" +macro index \Cf "unset wait_keyprintf 'Enter a search term to find with notmuch: '; read x; echo \$x >\"\${XDG_CACHE_HOME:-\$HOME/.cache}/mutt_terms\"~i \"\`notmuch search --output=messages \$(cat \"\${XDG_CACHE_HOME:-\$HOME/.cache}/mutt_terms\") | head -n 600 | perl -le '@a=<>;s/\^id:// for@a;$,=\"|\";print@a' | perl -le '@a=<>; chomp@a; s/\\+/\\\\+/g for@a; s/\\$/\\\\\\$/g for@a;print@a' \`\"" "show only messages matching a notmuch pattern" macro index A "all\n" "show all messages (undo limit)" # Sidebar mappings From 43eceb55364dc0e6b1bf35ff461f7c2554ff8e8e Mon Sep 17 00:00:00 2001 From: Jonas Dujava Date: Mon, 2 Sep 2024 12:24:34 +0200 Subject: [PATCH 22/25] Fix notifications for mails with multiline subject Signed-off-by: Jonas Dujava --- bin/mailsync | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/mailsync b/bin/mailsync index cbd36ff9..2cf66190 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -70,9 +70,10 @@ syncandnotify() { echo "$newcount new mail for $2." [ -z "$MAILSYNC_MUTE" ] && for file in $new; do - # Extract and decode subject and sender from mail. - subject="$(sed -n "/^Subject:/ s|Subject: *|| p" "$file" | - perl -CS -MEncode -ne 'print decode("MIME-Header", $_)')" + # Extract and decode subject and sender from mail. + subject=$(awk '/^Subject: / && ++n == 1,/^.*: / && ++i == 2' "$file" | head -n-1 | + perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | + sed 's/^Subject: //' | tr -d '\n\t') from="$(sed -n "/^From:/ s|From: *|| p" "$file" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)')" from="${from% *}" ; from="${from%\"}" ; from="${from#\"}" From 8e35e474c585adb428a88ff6da5e89754c49a448 Mon Sep 17 00:00:00 2001 From: Jonas Dujava Date: Mon, 2 Sep 2024 13:01:41 +0200 Subject: [PATCH 23/25] Fix usages of mail/mails Signed-off-by: Jonas Dujava --- bin/mailsync | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/mailsync b/bin/mailsync index cbd36ff9..792e7af7 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -63,11 +63,11 @@ syncandnotify() { newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l) case 1 in $((newcount > 5)) ) - echo "$newcount new mail for $2." - [ -z "$MAILSYNC_MUTE" ] && notify "New Mail!" "📬 $newcount new mail(s) in \`$2\` account." + echo "$newcount new mails for $2." + [ -z "$MAILSYNC_MUTE" ] && notify "New Mail!" "📬 $newcount new mails in \`$2\` account." ;; $((newcount > 0)) ) - echo "$newcount new mail for $2." + echo "$newcount new mail(s) for $2." [ -z "$MAILSYNC_MUTE" ] && for file in $new; do # Extract and decode subject and sender from mail. From 824feedc6889ae9630891c9b75e83b5387896838 Mon Sep 17 00:00:00 2001 From: Yaroslav Chvanov Date: Wed, 18 Sep 2024 22:29:55 +0300 Subject: [PATCH 24/25] fix(mailsync): delimit notification text from flags Fixes text being interpreted as flags when it starts with a dash. Try sending yourself a letter with subject starting with '-'. E.g. if subject is '-10%' fixes error: > Unknown option -10% --- bin/mailsync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mailsync b/bin/mailsync index cbd36ff9..866859e8 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -45,7 +45,7 @@ case "$(uname)" in notify() { [ -n "$pgrepoutput" ] && for x in ${displays:-:0}; do export DISPLAY="$x" - notify-send --app-name="mutt-wizard" "$1" "$2" + notify-send --app-name="mutt-wizard" -- "$1" "$2" done ;} ;; esac From 0a95e2cb9b939e33bc6a6decc517204a63160bbb Mon Sep 17 00:00:00 2001 From: Alexandr Sychev Date: Sat, 21 Sep 2024 14:12:47 +0300 Subject: [PATCH 25/25] fix -P option description formatting in mw.1 --- mw.1 | 1 + 1 file changed, 1 insertion(+) diff --git a/mw.1 b/mw.1 index 4a136eec..f40db457 100644 --- a/mw.1 +++ b/mw.1 @@ -70,6 +70,7 @@ SMTP server port (assumed to be 465 if not specified) .TP .B -x Account password. You will be prompted for the password interactively if this option is not given. +.TP .B -P Pass Prefix. The password will be stored using pass at .SH OTHER OPTIONS