From 9ac9843b670dfaabe2144be9ebb8260835ae5faf Mon Sep 17 00:00:00 2001 From: Kira Rose Date: Fri, 5 Jul 2019 18:41:11 +0000 Subject: [PATCH 001/225] Added hottmail.de --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index 24615ab..9ef1a27 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -101,6 +101,7 @@ hitler.rocks,mail.cock.li,993,mail.cock.li,587 horsefucker.org,mail.cock.li,993,mail.cock.li,587 hostgator,gator4171.hostgator.com,993,gator4171.hostgator.com,587 hotmail.com,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 +hotmail.de,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 hotmail.fr,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 hushmail.com,imap.hushmail.com,993,smtp.hushmail.com,465 illinois.edu, imap.gmail.com,993,smtp.gmail.com,465 From 5edde7ef8ee45905d5afba0067eb8dc8a6f95cd9 Mon Sep 17 00:00:00 2001 From: Ashley Glenday Date: Tue, 30 Jun 2020 21:27:49 +1000 Subject: [PATCH 002/225] Update domains.csv (#478) Added Australian ISP Bigpond. --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index 5ba77b0..18775ef 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -29,6 +29,7 @@ autoproduzioni.net,mail.autistici.org,993,smtp.autistici.org,465 bartender.net,imap.mail.com,993,smtp.mail.com,587 bastardi.net,mail.autistici.org,993,smtp.autistici.org,465 bguth.de,wp300.webpack.hosteurope.de,993,wp300.webpack.hosteurope.de,587 +bigpond.com,imap.telstra.com,143,smtp.telstra.com,587 bikerider.com,imap.mail.com,993,smtp.mail.com,587 billycarlyle.uk,mail.muny.us,993,mail.muny.us,465 birdlover.com,imap.mail.com,993,smtp.mail.com,587 From c4144ffb7c479830acf579caa05e9f85f71b36aa Mon Sep 17 00:00:00 2001 From: cl1pp0 <28967414+cl1pp0@users.noreply.github.com> Date: Sat, 4 Jul 2020 14:30:45 +0200 Subject: [PATCH 003/225] add mail.de to domains.csv (#485) Co-authored-by: cl1pp0 --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index 18775ef..69d6432 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -184,6 +184,7 @@ loves.dicksinhisan.us,mail.cock.li,993,mail.cock.li,587 loves.dicksinmyan.us,mail.cock.li,993,mail.cock.li,587 lukesmith.xyz,mail.lukesmith.xyz,993,mail.lukesmith.xyz,587 mail.com,imap.mail.com,993,smtp.mail.com,587 +mail.de,imap.mail.de,993,smtp.mail.de,465 mail.mcgill.ca,outlook.office365.com,993,smtp.office365.com,587 mail.polimi.it,outlook.office365.com,993,smtp.office365.com,587 mail.ru,imap.mail.ru,993,smtp.mail.ru,465 From 96c0073ecfa9d8063404c23b48570287adf1544d Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 9 Jul 2020 17:50:01 -0400 Subject: [PATCH 004/225] mailsync and cron removed, mw sync added --- README.md | 9 +++------ bin/mw | 35 ++++++++++------------------------- 2 files changed, 13 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 8681f8d..0da14f4 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,6 @@ Specifically, this wizard: - Encrypts and locally stores your password for easy remote access, accessible only by your GPG key - Handles as many as nine separate email accounts automatically - Auto-creates bindings to switch between accounts or between mailboxes -- Can automatically set mail updates as often as you want to sync your mail and update you when new mail arrives - Provides sensible defaults and an attractive appearance for the neomutt email client - If mutt-wizard doesn't know your server's IMAP/SMTP info by default, it will prompt you for them and will put them in all the right places. @@ -26,14 +25,14 @@ sudo make install User of Arch-based distros can also install mutt-wizard from the AUR as [mutt-wizard-git](https://aur.archlinux.org/packages/mutt-wizard-git/). -The mutt-wizard is run with the command `mw`. It also installs the `mailsync` command. Once everything is setup, you'll use `neomutt` to access your mail. +The mutt-wizard is run with the command `mw`. Once everything is setup, you'll use `neomutt` to access your mail. - `mw add` -- add a new email account - `mw ls` -- list existing accounts - `mw pass` -- revise an account's password - `mw delete` -- delete an added account +- `mw sync` -- sync all mail accounts and update notmuch database - `mw purge` -- delete all accounts and settings -- `mw cron` -- toggle/configure a cronjob to sync mail ## Dependencies @@ -47,10 +46,8 @@ There's a chance of errors if you use a slow-release distro like Ubuntu, Debian ### Optional - `lynx` - view HTML email in neomutt. -- `notmuch` - index and search mail. Install it and run `notmuch setup`, tell it that your mail is in `~/.local/share/mail/` (although `mw` will do this automatically if you haven't set notmuch up before). You can run it in mutt with `ctrl-f`. Run `notmuch new` to process new mail, although the included `mailsync` script does this for you. -- `libnotify`/`libnotify-bin` - allows notifications when syncing mail with `mailsync` +- `notmuch` - index and search mail. Install it and run `notmuch setup`, tell it that your mail is in `~/.local/share/mail/` (although `mw` will do this automatically if you haven't set notmuch up before). You can run it in mutt with `ctrl-f`. Run `notmuch new` to process new mail. - `abook` - a terminal-based address book. Pressing tab while typing an address to send mail to will suggest contacts that are in your abook. -- A cron manager - if you want to enable the auto-sync feature. - `pam-gnupg` - this is a more general program that I use. It automatically logs you into your GPG key on login so you will never need to input your password once logged on to your system. Check the repo and directions out [here](https://github.com/cruegge/pam-gnupg). - `urlview` - outputs urls in mail to browser. diff --git a/bin/mw b/bin/mw index c7a5c62..d04204b 100755 --- a/bin/mw +++ b/bin/mw @@ -97,7 +97,7 @@ bind index,pager g noop bind index,pager M noop bind index,pager C noop bind index gg first-entry -macro index o \"mailsync -V $title\" \"run mbsync to sync $title\" +macro index o \"mbsync -V $title\" \"run mbsync to sync $title\" unmailboxes * " else @@ -286,27 +286,6 @@ delete() { sed -ibu "/IMAPStore $title-remote$/,/# End profile/d" "$mbsyncrc" ; sed -ibu "/account $title/,/^\(\s*$\|account\)/d" "$msmtprc"; rm -f "$msmtprc"bu } -choosecron() { ! pgrep cron >/dev/null && echo "No cron manager running. Install/enable one and then select this option again." && return 1 - if crontab -l | grep mailsync >/dev/null; then - echo "Active mail sync cronjob detected. Do you want to remove it?" - printf "\033[36m\t" - read -r rmyn - printf "\033[0m" - echo "$rmyn" | grep -i "^y\(es\)*$" >/dev/null && crontab -l | sed '/mailsync/d' | crontab - >/dev/null && echo "Mail sync turned off." - else - echo "How many minutes between each mail sync?" - printf "\033[36m\t" - read -r minnum - printf "\033[0m" - while ! echo "$minnum" | grep "^[0-9]\+$" >/dev/null; do - printf "That doesn't look like a number. How many minutes between each mail sync?\\n\033[36m\t" - read -r minnum - printf "\033[0m" - done - (crontab -l; echo "*/$minnum * * * * $(type mailsync | cut -d' ' -f3) >/dev/null 2>&1") | crontab - >/dev/null && - echo "Cronjob added. Mail will sync every $minnum minutes. Be sure you have your cron manager running." - fi ;} - asktype() { while : ; do printf "Do you want to keep your mail for this account offline with mbsync? [yes/no]\\n\t" read -r offnot @@ -318,11 +297,17 @@ asktype() { while : ; do purge() { confirm "delete all account data" || exit rm -rf "$mbsyncrc" "$accdir" "$HOME/.config/msmtp" "$cachedir" - crontab -l | sed '/mailsync/d' | crontab - >/dev/null echo "All configs and account settings have been purged." sed -ibu "/\# mw-autogenerated/d" "$muttrc" ; rm -f "$muttrc"bu } +syncwrapper() { mbsync -a & + ( kill -46 "$(pidof "${STATUSBAR:-dwmblocks}")" >/dev/null 2>&1 ) 2>/dev/null + wait + ( kill -46 "$(pidof "${STATUSBAR:-dwmblocks}")" >/dev/null 2>&1 ) 2>/dev/null + notmuch new +} + notmuchauto() { \ [ -z "$NOTMUCH_CONFIG" ] && NOTMUCH_CONFIG="$HOME/.notmuch-config" [ -f "$NOTMUCH_CONFIG" ] && return 0 @@ -349,8 +334,8 @@ case "$1" in add) asktype && askinfo && tryconnect && finalize || delete ;; pass) pick "change the password of" && getpass ;; delete) pick delete && confirm "delete the \`$title\` profile" && delete ;; + sync) syncwrapper ;; purge) purge ;; - cron) choosecron ;; *) cat << EOF mw: mutt-wizard, auto-configure email accounts for mutt including downloadable mail with \`isync\`. @@ -360,7 +345,7 @@ Allowed options: ls List configured accounts delete Pick an account to delete purge Delete all accounts and settings - cron Enable or disable an autosync via cronjob + sync Syncs mail and updates notmuch database all else Print this message NOTE: Once at least one account is added, you can run From 16188017b29b58708593963ae894a13c5251d9d7 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 9 Jul 2020 17:55:56 -0400 Subject: [PATCH 005/225] like i said... --- bin/mailsync | 71 ---------------------------------------------------- 1 file changed, 71 deletions(-) delete mode 100755 bin/mailsync diff --git a/bin/mailsync b/bin/mailsync deleted file mode 100755 index 93ec35d..0000000 --- a/bin/mailsync +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/sh - -# Sync mail and give notification if there is new mail. - -# Run only if user logged in (prevent cron errors) -pgrep -u "${USER:=$LOGNAME}" >/dev/null || { echo "$USER not logged in; sync will not run."; exit ;} -# Run only if not already running in other instance -pgrep -x mbsync >/dev/null && { echo "mbsync is already running." ; exit ;} - -# Checks for internet connection and set notification script. -ping -q -c 1 1.1.1.1 > /dev/null || ping -q -c 1 1.0.0.1 > /dev/null || ping -q -c 1 example.org || { echo "No internet connection detected."; exit ;} -command -v notify-send >/dev/null || echo "Note that \`libnotify\` or \`libnotify-send\` should be installed for pop-up mail notifications with this script." - -# Required to display notifications if run as a cronjob: -export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus -export DISPLAY=:0.0 - -# For individual configurations: -[ -d "$HOME/.local/share/password-store" ] && export PASSWORD_STORE_DIR="$HOME/.local/share/password-store" - -# Settings are different for MacOS (Darwin) systems. -if [ "$(uname)" = "Darwin" ]; then - notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $account\"" && sleep 2 ;} - messageinfo() { osascript -e "display notification with title \"📧 $from\" subtitle \"$subject\"" ;} -else - notify() { notify-send --app-name="mutt-wizard" "mutt-wizard" "📬 $2 new mail(s) in \`$1\` account." ;} - messageinfo() { notify-send --app-name="mutt-wizard" "📧$from:" "$subject" ;} -fi - -# Check account for new mail. Notify if there is new content. -syncandnotify() { - acc="$(echo "$account" | sed "s/.*\///")" - if [ -z "$opts" ]; then mbsync "$acc"; else mbsync "$opts" "$acc"; fi - new=$(find "$HOME/.local/share/mail/$acc/INBOX/new/" "$HOME/.local/share/mail/$acc/Inbox/new/" "$HOME/.local/share/mail/$acc/inbox/new/" -type f -newer "$HOME/.config/mutt/.mailsynclastrun" 2> /dev/null) - newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l) - if [ "$newcount" -gt "0" ]; then - notify "$acc" "$newcount" & - for file in $new; do - # Extract subject and sender from mail. - from=$(awk '/^From: / && ++n ==1,/^\<.*\>:/' "$file" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | awk '{ $1=""; if (NF>=3)$NF=""; print $0 }' | sed 's/^[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//') - subject=$(awk '/^Subject: / && ++n == 1,/^\<.*\>: / && ++i == 2' "$file" | head -n 1 | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | sed 's/^Subject: //' | sed 's/^{[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//' | tr -d '\n') - messageinfo & - done - fi -} - -# Sync accounts passed as argument or all. -if [ "$#" -eq "0" ]; then - accounts="$(awk '/^Channel/ {print $2}' "$HOME/.mbsyncrc")" -else - for arg in "$@"; do - [ "${arg%${arg#?}}" = '-' ] && opts="${opts:+${opts} }${arg}" && shift 1 - done - accounts=$* -fi - -( kill -46 "$(pidof "${STATUSBAR:-dwmblocks}")" >/dev/null 2>&1 ) 2>/dev/null - -# Parallelize multiple accounts -for account in $accounts -do - syncandnotify & -done - -wait -( kill -46 "$(pidof "${STATUSBAR:-dwmblocks}")" >/dev/null 2>&1 ) 2>/dev/null - -notmuch new 2>/dev/null - -#Create a touch file that indicates the time of the last run of mailsync -touch "$HOME/.config/mutt/.mailsynclastrun" From 1ace8994f402b9b7e644137f291e1e935ce7c802 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sat, 18 Jul 2020 18:51:30 -0400 Subject: [PATCH 006/225] update man; fix #497 --- mw.1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mw.1 b/mw.1 index 217ae2b..55ad43c 100644 --- a/mw.1 +++ b/mw.1 @@ -28,8 +28,8 @@ delete the configuration files for an already configured email account .B purge totally purge all local mutt-wizard accounts .TP -.B cron -toggle a cronjob that will automatically sync mail with +.B sync +sync mail accounts then update notmuch database .B mailsync as often as you wish .SH DETAILS From a2623f77cc77fa26317d7bc6887a215b708db3f4 Mon Sep 17 00:00:00 2001 From: g-w1 <58830309+g-w1@users.noreply.github.com> Date: Sun, 19 Jul 2020 17:58:53 -0400 Subject: [PATCH 007/225] Add audio playback with mailcap and mpv (#499) Allow audio to also be listened to from an email. Did not include setsid because then there would be no way to pause. --- share/mailcap | 1 + 1 file changed, 1 insertion(+) diff --git a/share/mailcap b/share/mailcap index 5bd2471..b355f32 100644 --- a/share/mailcap +++ b/share/mailcap @@ -3,6 +3,7 @@ text/html; openfile %s ; nametemplate=%s.html text/html; lynx -assume_charset=%{charset} -display_charset=utf-8 -dump %s; nametemplate=%s.html; copiousoutput; image/*; openfile %s ; video/*; setsid mpv --quiet %s &; copiousoutput +audio/*; mpv %s ; application/pdf; openfile %s ; application/pgp-encrypted; gpg -d '%s'; copiousoutput; application/pgp-keys; gpg --import '%s'; copiousoutput; From 913c05b145353d920396f07818e0b7dd60415a1f Mon Sep 17 00:00:00 2001 From: Pim Beune <47817451+beune@users.noreply.github.com> Date: Sun, 26 Jul 2020 13:15:17 +0200 Subject: [PATCH 008/225] Update domains.csv (#498) --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index 69d6432..5b9a8e2 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -317,3 +317,4 @@ ymail.com,imap.mail.yahoo.com,993,smtp.mail.yahoo.com,465 zaclys.net,mail.zaclys.net,993,mail.zaclys.net,465 zoho.com,imap.zoho.com,993,smtp.zoho.com,465 zohomail.eu,imap.zoho.eu,993,smtp.zoho.eu,465 +student.utwente.nl,imap.gmail.com,993,smtp.gmail.com,587 From fc610e889857c1a3a250f040c8358d34d8561fb8 Mon Sep 17 00:00:00 2001 From: samadouz <39070773+samadouz@users.noreply.github.com> Date: Sat, 8 Aug 2020 19:08:40 +0200 Subject: [PATCH 009/225] update domains.csv (#507) --- share/domains.csv | 2 ++ 1 file changed, 2 insertions(+) diff --git a/share/domains.csv b/share/domains.csv index 5b9a8e2..a8c504e 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -318,3 +318,5 @@ zaclys.net,mail.zaclys.net,993,mail.zaclys.net,465 zoho.com,imap.zoho.com,993,smtp.zoho.com,465 zohomail.eu,imap.zoho.eu,993,smtp.zoho.eu,465 student.utwente.nl,imap.gmail.com,993,smtp.gmail.com,587 +univ-ubs.fr,partage.univ-ubs.fr,993,partage.univ-ubs.fr,587 + From 1492a11b3ee0a1c3f5544a351089ff154521b68b Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sat, 8 Aug 2020 13:09:26 -0400 Subject: [PATCH 010/225] sort --- share/domains.csv | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/share/domains.csv b/share/domains.csv index a8c504e..2c17820 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -256,6 +256,7 @@ stud.uni-bamberg.de,outlook.office365.com,993,smtp.office365.com,587 student.binadarma.ac.id,imap.gmail.com,993,smtp.gmail.com,587 student.rmit.edu.au,outlook.office365.com,993,smtp.office365.com,587 student.tuwien.ac.at,mail.student.tuwien.ac.at,993,mail.student.tuwien.ac.at,587 +student.utwente.nl,imap.gmail.com,993,smtp.gmail.com,587 studenti.unipi.it,outlook.office365.com,993,smtp.office365.com,587 students.rmcacs.org,imap.gmail.com,993,smtp.gmail.com,587 students.southwales.ac.uk,imap.gmail.com,993,smtp.gmail.com,587 @@ -282,6 +283,7 @@ ucdavis.edu,imap.gmail.com,993,smtp.gmail.com,587 uni-duesseldorf.de,mail.hhu.de,993,mail.hhu.de,465 unilodz.eu,outlook.office365.com,993,smtp.office365.com,587 unitybox.de,mail.unity-mail.de,993,mail.unity-mail.de,587 +univ-ubs.fr,partage.univ-ubs.fr,993,partage.univ-ubs.fr,587 uoregon.edu,imap.uoregon.edu,993,smtp.uoregon.edu,587 uqtr.ca,outlook.office365.com,993,smtp.office365.com,587 usa.com,imap.mail.com,993,smtp.mail.com,587 @@ -317,6 +319,3 @@ ymail.com,imap.mail.yahoo.com,993,smtp.mail.yahoo.com,465 zaclys.net,mail.zaclys.net,993,mail.zaclys.net,465 zoho.com,imap.zoho.com,993,smtp.zoho.com,465 zohomail.eu,imap.zoho.eu,993,smtp.zoho.eu,465 -student.utwente.nl,imap.gmail.com,993,smtp.gmail.com,587 -univ-ubs.fr,partage.univ-ubs.fr,993,partage.univ-ubs.fr,587 - From 57a3f317ade14ca65c02e29dedc59059b97ea6c2 Mon Sep 17 00:00:00 2001 From: Luke Bubar <43391582+lukerb52@users.noreply.github.com> Date: Wed, 12 Aug 2020 08:38:31 -0400 Subject: [PATCH 011/225] Update domains.csv (#508) --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index 2c17820..631eff6 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -51,6 +51,7 @@ clasnet.sunyocc.edu,outlook.office365.com,993,smtp.office365.com,587 clerk.com,imap.mail.com,993,smtp.mail.com,587 clubmember.org,imap.mail.com,993,smtp.mail.com,587 cmail.carleton.ca,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 +cn.edu,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 cocaine.ninja,mail.cock.li,993,mail.cock.li,587 cock.email,mail.cock.li,993,mail.cock.li,587 cock.li,mail.cock.li,993,mail.cock.li,587 From 2cd21c2db29e0a79a8fb7c667af6bf5b1a962da0 Mon Sep 17 00:00:00 2001 From: "A. Tammy" Date: Thu, 13 Aug 2020 16:02:34 -0400 Subject: [PATCH 012/225] add check for MANPREFIX (#510) --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 70f780d..1d8d362 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,9 @@ OS = $(shell uname -s) ifndef PREFIX PREFIX = /usr/local endif -MANPREFIX = $(PREFIX)/share/man +ifndef MANPREFIX + MANPREFIX = $(PREFIX)/share/man +endif install: mkdir -p $(DESTDIR)$(PREFIX)/bin From aece24c7ddb058589273e5e0b7cc89b70d6a54e1 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 27 Aug 2020 16:38:14 -0400 Subject: [PATCH 013/225] revert auto gpg to fix #491 #484 #493 etc --- bin/mw | 12 ------------ share/mutt-wizard.muttrc | 5 +++++ 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/bin/mw b/bin/mw index 41e07e7..c0528de 100755 --- a/bin/mw +++ b/bin/mw @@ -87,11 +87,6 @@ set header_cache = $cachedir/$title/headers set message_cachedir = $cachedir/$title/bodies set mbox_type = Maildir -set crypt_autosign = yes -set crypt_opportunistic_encrypt = yes -set pgp_self_encrypt = yes -set pgp_default_key = $keyid - bind index,pager gg noop bind index,pager g noop bind index,pager M noop @@ -113,12 +108,6 @@ set header_cache = $cachedir/$title/headers set message_cachedir = $cachedir/$title/bodies set imap_pass = \"\`pass mutt-wizard-$title\`\" -set crypt_autosign = yes -set crypt_opportunistic_encrypt = yes -set pgp_self_encrypt = yes -set pgp_default_key = $keyid - - set mbox_type = Maildir set ssl_starttls = yes set ssl_force_tls = yes @@ -137,7 +126,6 @@ fi askinfo() { \ printf "Insert the \033[31memail address\033[0m that you want to autoconfigure for mutt/mbsync\\n\tEmail: \033[36m" read -r fulladdr - keyid=$("$GPG" --list-keys --with-colons "$fulladdr" | awk -F: '/^pub:/ { print $5 }') printf "\033[0m" while ! echo "$fulladdr" | grep "$emailre" >/dev/null; do printf "That is not a valid \033[31memail address\033[0m, please retype the desired email.\\n\\nEmail: \033[36m\t" diff --git a/share/mutt-wizard.muttrc b/share/mutt-wizard.muttrc index aafb3d5..e7fa8c8 100644 --- a/share/mutt-wizard.muttrc +++ b/share/mutt-wizard.muttrc @@ -63,6 +63,11 @@ bind pager \031 previous-line # Mouse wheel bind pager \005 next-line # Mouse wheel bind editor complete-query +#set crypt_autosign = yes +#set crypt_opportunistic_encrypt = yes +#set pgp_self_encrypt = yes +#set pgp_default_key = 'your@gpgemailaddre.ss' + 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 "mbsync -a" "run mbsync to sync all mail" From d3f34931a6b27179f34431d1817dab872aea6b99 Mon Sep 17 00:00:00 2001 From: jackhanslope <30721726+jackhanslope@users.noreply.github.com> Date: Thu, 27 Aug 2020 21:42:52 +0100 Subject: [PATCH 014/225] Add @btinternet.com to domains.csv (#513) --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index 631eff6..a68fab6 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -37,6 +37,7 @@ bjoernguthphotography.de,wp300.webpack.hosteurope.de,993,wp300.webpack.hosteurop bocken.org,imap.gmail.com,993,smtp.gmail.com,465 brew-meister.com,imap.mail.com,993,smtp.mail.com,587 bruttocarattere.org,mail.autistici.org,993,smtp.autistici.org,465 +btinternet.com,mail.btinternet.com,993,mail.btinternet.com,587 canaglie.net,mail.autistici.org,993,smtp.autistici.org,465 canaglie.org,mail.autistici.org,993,smtp.autistici.org,465 carleton.ca,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 From f87acd70421a177b4b63120e6c9c3b17ab3c369f Mon Sep 17 00:00:00 2001 From: "A. Tammy" Date: Thu, 27 Aug 2020 16:43:24 -0400 Subject: [PATCH 015/225] fix regex check for email address (#511) -E option is cross platform and interprets pattern as regular expression always Co-authored-by: Aisha Tammy --- bin/mw | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/mw b/bin/mw index c0528de..2d32859 100755 --- a/bin/mw +++ b/bin/mw @@ -14,7 +14,7 @@ muttdir="$HOME/.config/mutt" # Main mutt config location accdir="$muttdir/accounts" # Directory for account settings maildir="$HOME/.local/share/mail" # Location of mail storage namere="^[a-z_][a-z0-9_-]*$" # Regex to ensure viable username -emailre=".\+@.\+\\..\+" # Regex to confirm valid email address +emailre=".+@.+\..+" # Regex to confirm valid email address muttshare="$prefix/share/mutt-wizard" mbsyncrc="$HOME/.mbsyncrc" mwconfig="$muttshare/mutt-wizard.muttrc" @@ -127,7 +127,7 @@ askinfo() { \ printf "Insert the \033[31memail address\033[0m that you want to autoconfigure for mutt/mbsync\\n\tEmail: \033[36m" read -r fulladdr printf "\033[0m" - while ! echo "$fulladdr" | grep "$emailre" >/dev/null; do + while ! echo "$fulladdr" | grep -E "$emailre" >/dev/null; do printf "That is not a valid \033[31memail address\033[0m, please retype the desired email.\\n\\nEmail: \033[36m\t" read -r fulladdr printf "\033[0m" From abe90a1bc4a2ceee3580fad2e8e25fad0a06ec35 Mon Sep 17 00:00:00 2001 From: Alexander Bocken <32177905+AlexBocken@users.noreply.github.com> Date: Thu, 27 Aug 2020 22:45:43 +0200 Subject: [PATCH 016/225] updated 2 domains (#481) --- share/domains.csv | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/share/domains.csv b/share/domains.csv index a68fab6..a6abfc6 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -34,7 +34,7 @@ bikerider.com,imap.mail.com,993,smtp.mail.com,587 billycarlyle.uk,mail.muny.us,993,mail.muny.us,465 birdlover.com,imap.mail.com,993,smtp.mail.com,587 bjoernguthphotography.de,wp300.webpack.hosteurope.de,993,wp300.webpack.hosteurope.de,587 -bocken.org,imap.gmail.com,993,smtp.gmail.com,465 +bocken.org,mail.bocken.org,993,mail.bocken.org,587 brew-meister.com,imap.mail.com,993,smtp.mail.com,587 bruttocarattere.org,mail.autistici.org,993,smtp.autistici.org,465 btinternet.com,mail.btinternet.com,993,mail.btinternet.com,587 @@ -256,6 +256,7 @@ stud.tu-darmstadt.de,imap.stud.tu-darmstadt.de,993,smtp.tu-darmstadt.de,465 stud.uis.no,outlook.office365.com,993,smtp.office365.com,587 stud.uni-bamberg.de,outlook.office365.com,993,smtp.office365.com,587 student.binadarma.ac.id,imap.gmail.com,993,smtp.gmail.com,587 +student.ethz.ch,mail.ethz.ch,993,mail.ethz.ch,587 student.rmit.edu.au,outlook.office365.com,993,smtp.office365.com,587 student.tuwien.ac.at,mail.student.tuwien.ac.at,993,mail.student.tuwien.ac.at,587 student.utwente.nl,imap.gmail.com,993,smtp.gmail.com,587 From 9910b434c2a1ce21dc7f5db7336b78eb645d959b Mon Sep 17 00:00:00 2001 From: Lorenzo Leonardini Date: Thu, 27 Aug 2020 22:46:36 +0200 Subject: [PATCH 017/225] Top-level domain wildcard (#475) --- bin/mw | 4 +++ share/domains.csv | 77 ++++++----------------------------------------- 2 files changed, 14 insertions(+), 67 deletions(-) diff --git a/bin/mw b/bin/mw index 2d32859..f8d9d7b 100755 --- a/bin/mw +++ b/bin/mw @@ -149,6 +149,10 @@ askinfo() { \ esac printf "\\nSearching for \033[32m%s\033[0m in \033[34m\`domains.csv\`\033[0m..." "$domain" serverinfo="$(grep "^$search_query" "$muttshare/domains.csv" 2>/dev/null)" + if [ -z "$serverinfo" ]; then + search_query=$(echo "$search_query" | sed "s/\.[^\.]*$/\.\\\*/") + serverinfo="$(grep "^$search_query" "$muttshare/domains.csv" 2>/dev/null)" + fi if [ -z "$serverinfo" ]; then printf "Your email domain is not in mutt-wizard's database yet.\\nmutt-wizard will still autoconfigure everything, but you will have to manually type in your service's IMAP and SMTP server information.\\nYou can usually quickly find this by internet searching for it.\\n" printf "Insert the IMAP server for your email provider (excluding the port number)\\n\033[36m\t" diff --git a/share/domains.csv b/share/domains.csv index a6abfc6..9db3601 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -96,64 +96,20 @@ 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 gmail.com,imap.gmail.com,993,smtp.gmail.com,587 -gmx.at,imap.gmx.net,993,mail.gmx.net,587 -gmx.com,imap.gmx.net,993,mail.gmx.net,587 -gmx.de,imap.gmx.net,993,mail.gmx.net,587 -gmx.eu,imap.gmx.net,993,mail.gmx.net,587 -gmx.fr,imap.gmx.com,993,mail.gmx.com,587 -gmx.info,imap.gmx.net,993,mail.gmx.net,587 -gmx.net,imap.gmx.net,993,mail.gmx.net,587 -gmx.org,imap.gmx.net,993,mail.gmx.net,587 +gmx.*,imap.gmx.net,993,mail.gmx.net,587 go2.pl,poczta.o2.pl,993,poczta.o2.pl,465 goat.si,mail.cock.li,993,mail.cock.li,587 googlemail.com,imap.googlemail.com,993,smtp.googlemail.com,587 grrlz.net,mail.autistici.org,993,smtp.autistici.org,465 -hacari.com,mail.autistici.org,993,smtp.autistici.org,465 -hacari.net,mail.autistici.org,993,smtp.autistici.org,465 -hacari.org,mail.autistici.org,993,smtp.autistici.org,465 +hacari.*,mail.autistici.org,993,smtp.autistici.org,465 helsinki.fi,outlook.office365.com,993,smtp.helsinki.fi,587 hhu.de,mail.hhu.de,993,mail.hhu.de,465 hitler.rocks,mail.cock.li,993,mail.cock.li,587 horsefucker.org,mail.cock.li,993,mail.cock.li,587 hostgator,gator4171.hostgator.com,993,gator4171.hostgator.com,587 -hotmail.be,outlook.office365.com,993,smtp.office365.com,587 -hotmail.ca,outlook.office365.com,993,smtp.office365.com,587 -hotmail.cl,outlook.office365.com,993,smtp.office365.com,587 -hotmail.co.id,outlook.office365.com,993,smtp.office365.com,587 -hotmail.co.il,outlook.office365.com,993,smtp.office365.com,587 -hotmail.co.in,outlook.office365.com,993,smtp.office365.com,587 -hotmail.co.jp,outlook.office365.com,993,smtp.office365.com,587 -hotmail.co.kr,outlook.office365.com,993,smtp.office365.com,587 -hotmail.co.th,outlook.office365.com,993,smtp.office365.com,587 -hotmail.co.uk,outlook.office365.com,993,smtp.office365.com,587 -hotmail.co.za,outlook.office365.com,993,smtp.office365.com,587 -hotmail.com,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 -hotmail.com.ar,outlook.office365.com,993,smtp.office365.com,587 -hotmail.com.au,outlook.office365.com,993,smtp.office365.com,587 -hotmail.com.br,outlook.office365.com,993,smtp.office365.com,587 -hotmail.com.hk,outlook.office365.com,993,smtp.office365.com,587 -hotmail.com.tr,outlook.office365.com,993,smtp.office365.com,587 -hotmail.com.tw,outlook.office365.com,993,smtp.office365.com,587 -hotmail.com.vn,outlook.office365.com,993,smtp.office365.com,587 -hotmail.cz,outlook.office365.com,993,smtp.office365.com,587 -hotmail.de,outlook.office365.com,993,smtp.office365.com,587 -hotmail.dk,outlook.office365.com,993,smtp.office365.com,587 -hotmail.es,outlook.office365.com,993,smtp.office365.com,587 -hotmail.fi,outlook.office365.com,993,smtp.office365.com,587 -hotmail.fr,outlook.office365.com,993,smtp.office365.com,587 -hotmail.gr,outlook.office365.com,993,smtp.office365.com,587 -hotmail.hu,outlook.office365.com,993,smtp.office365.com,587 -hotmail.it,outlook.office365.com,993,smtp.office365.com,587 -hotmail.lt,outlook.office365.com,993,smtp.office365.com,587 -hotmail.lv,outlook.office365.com,993,smtp.office365.com,587 -hotmail.my,outlook.office365.com,993,smtp.office365.com,587 -hotmail.nl,outlook.office365.com,993,smtp.office365.com,587 -hotmail.no,outlook.office365.com,993,smtp.office365.com,587 -hotmail.ph,outlook.office365.com,993,smtp.office365.com,587 -hotmail.rs,outlook.office365.com,993,smtp.office365.com,587 -hotmail.se,outlook.office365.com,993,smtp.office365.com,587 -hotmail.sg,outlook.office365.com,993,smtp.office365.com,587 -hotmail.sk,outlook.office365.com,993,smtp.office365.com,587 +hotmail.*,outlook.office365.com,993,smtp.office365.com,587 +hotmail.co.*,outlook.office365.com,993,smtp.office365.com,587 +hotmail.com.*,outlook.office365.com,993,smtp.office365.com,587 hs-mittweida.de,mail.hs-mittweida.de,993,mail.hs-mittweida.de,465 humbug.pw,imap.migadu.com,993,smtp.migadu.com,587 hushmail.com,imap.hushmail.com,993,smtp.hushmail.com,465 @@ -166,8 +122,7 @@ infomaniak.com,imap.infomaniak.com,993,imap.infomaniak.com,587 insiberia.net,mail.autistici.org,993,smtp.autistici.org,465 insicuri.net,mail.autistici.org,993,smtp.autistici.org,465 interactio.io,imap.gmail.com,993,smtp.gmail.com,587 -interia.eu,poczta.interia.pl,993,poczta.interia.pl,465 -interia.pl,poczta.interia.pl,993,poczta.interia.pl,465 +interia.*,poczta.interia.pl,993,poczta.interia.pl,465 inventati.org,mail.autistici.org,993,smtp.autistici.org,465 ionos.de,imap.ionos.de,993,smtp.ionos.de,587 itu.dk,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 @@ -220,9 +175,7 @@ online.de,imap.1und1.de,993,smtp.1und1.de,465 op.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465 opoczta.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465 orange.fr,imap.orange.fr,993,smtp.orange.fr,465 -outlook.at,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 -outlook.com,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 -outlook.de,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 +outlook.*,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 outlook.es,outlook.office365.com,993,smtp.office365.com,587 paranoici.org,mail.autistici.org,993,smtp.autistici.org,465 pm.me,127.0.0.1,1143,127.0.0.1,1025 @@ -230,10 +183,8 @@ poczta.fm,poczta.interia.pl,993,poczta.interia.pl,465 poczta.onet.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465 polimi.it,outlook.office365.com,993,smtp.office365.com,587 polito.it,mail.polito.it,993,mail.polito.it,465 -polito.it,mail.polito.it,993,mail.polito.it,465 post.com,imap.mail.com,993,smtp.mail.com,587 -posteo.de,posteo.de,993,posteo.de,587 -posteo.net,posteo.de,993,posteo.de,587 +posteo.*,posteo.de,993,posteo.de,587 privacyrequired.com,mail.autistici.org,993,smtp.autistici.org,465 prokonto.pl,poczta.o2.pl,993,poczta.o2.pl,465 protonmail.ch,127.0.0.1,1143,127.0.0.1,1025 @@ -264,7 +215,6 @@ studenti.unipi.it,outlook.office365.com,993,smtp.office365.com,587 students.rmcacs.org,imap.gmail.com,993,smtp.gmail.com,587 students.southwales.ac.uk,imap.gmail.com,993,smtp.gmail.com,587 studio.unibo.it,outlook.office365.com,993,smtp.office365.com,587 -studio.unibo.it,outlook.office365.com,993,smtp.office365.com,587 studserv.uni-leipzig.de,studserv.uni-leipzig.de,993,studserv.uni-leipzig.de,25 subvertising.org,mail.autistici.org,993,smtp.autistici.org,465 t-online.de,secureimap.t-online.de,993,securesmtp.t-online.de,465 @@ -309,15 +259,8 @@ wit.edu,outlook.office365.com,993,smtp.office365.com,587 wp.pl,imap.wp.pl,993,smtp.wp.pl,465 writeme.com,imap.mail.com,993,smtp.mail.com,587 ya.ru,imap.yandex.com,993,smtp.yandex.com,587 -yahoo.com,imap.mail.yahoo.com,993,smtp.mail.yahoo.com,587 -yahoo.fr,imap.mail.yahoo.com,993,smtp.mail.yahoo.com,587 -yahoo.gr,imap.mail.yahoo.com,993,smtp.mail.yahoo.com,587 -yandex.by,imap.yandex.com,993,smtp.yandex.com,587 -yandex.com,imap.yandex.com,993,smtp.yandex.com,587 -yandex.kz,imap.yandex.com,993,smtp.yandex.com,587 -yandex.net,imap.yandex.com,993,smtp.yandex.com,587 -yandex.ru,imap.yandex.com,993,smtp.yandex.com,587 -yandex.ua,imap.yandex.com,993,smtp.yandex.com,587 +yahoo.*,imap.mail.yahoo.com,993,smtp.mail.yahoo.com,587 +yandex.*,imap.yandex.com,993,smtp.yandex.com,587 ymail.com,imap.mail.yahoo.com,993,smtp.mail.yahoo.com,465 zaclys.net,mail.zaclys.net,993,mail.zaclys.net,465 zoho.com,imap.zoho.com,993,smtp.zoho.com,465 From 38213235727efb7e70a67d8bf3d92a13a2c479eb Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 27 Aug 2020 16:54:06 -0400 Subject: [PATCH 018/225] mw sync can take arg, otherwise sync all --- bin/mw | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/mw b/bin/mw index c0528de..c83274f 100755 --- a/bin/mw +++ b/bin/mw @@ -289,7 +289,7 @@ purge() { confirm "delete all account data" || exit sed -ibu "/\# mw-autogenerated/d" "$muttrc" ; rm -f "$muttrc"bu } -syncwrapper() { mbsync -a & +syncwrapper() { mbsync "${1:--a}" & ( kill -46 "$(pidof "${STATUSBAR:-dwmblocks}")" >/dev/null 2>&1 ) 2>/dev/null wait ( kill -46 "$(pidof "${STATUSBAR:-dwmblocks}")" >/dev/null 2>&1 ) 2>/dev/null @@ -322,7 +322,7 @@ case "$1" in add) asktype && askinfo && tryconnect && finalize || delete ;; pass) pick "change the password of" && getpass ;; delete) pick delete && confirm "delete the \`$title\` profile" && delete ;; - sync) syncwrapper ;; + sync) syncwrapper $2 ;; purge) purge ;; *) cat << EOF mw: mutt-wizard, auto-configure email accounts for mutt From 06f416f5eb73c4d01df25046d17a1cfdbfb116ae Mon Sep 17 00:00:00 2001 From: Jonassenher Date: Sun, 30 Aug 2020 18:28:21 +0200 Subject: [PATCH 019/225] Support for XDG Base Directory Today's mutt-wizard does not support the XDG Base Directory specifications (https://wiki.archlinux.org/index.php/XDG_Base_Directory) because it says the user should be able to change the config, cache, data folders etc. using the environmental variables XDG_CONFIG_HOME, XDG_CACHE_HOME, and XDG_DATA_HOME, and instead hard codes the default paths ~/.config, ~/.cache, and ~/.local/share. My commit corrects this. --- bin/mw | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bin/mw b/bin/mw index 9f39cc4..fffc965 100755 --- a/bin/mw +++ b/bin/mw @@ -10,17 +10,17 @@ command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2" ! command -v mbsync >/dev/null && printf "\`mbsync (isync package)\` must be installed to run mutt-wizard.\\n" && exit prefix="/usr/local" -muttdir="$HOME/.config/mutt" # Main mutt config location +muttdir="${XDG_CONFIG_HOME:-$HOME/.config}/mutt" # Main mutt config location accdir="$muttdir/accounts" # Directory for account settings -maildir="$HOME/.local/share/mail" # Location of mail storage +maildir="${XDG_DATA_HOME:-$HOME/.local/share}/mail" # Location of mail storage namere="^[a-z_][a-z0-9_-]*$" # Regex to ensure viable username emailre=".+@.+\..+" # Regex to confirm valid email address muttshare="$prefix/share/mutt-wizard" -mbsyncrc="$HOME/.mbsyncrc" +mbsyncrc="${MBSYNCRC_HOME:-$HOME/.mbsyncrc}" mwconfig="$muttshare/mutt-wizard.muttrc" -cachedir="$HOME/.cache/mutt-wizard" +cachedir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard" muttrc="$muttdir/muttrc" -msmtprc="$HOME/.config/msmtp/config" +msmtprc="${XDG_CACHE_HOME:-$HOME/.config}/msmtp/config" ssltype="IMAPS" # This is later changed to `None` later in the script if using Protonmail for x in "/etc/ssl/certs/ca-certificates.crt" "/etc/pki/tls/certs/ca-bundle.crt" "/etc/ssl/ca-bundle.pem" "/etc/pki/tls/cacert.pem" "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem" "/etc/ssl/cert.pem" "/usr/local/share/ca-certificates/" @@ -38,7 +38,7 @@ msmtp_header="defaults auth on tls on tls_trust_file $sslcert -logfile ~/.config/msmtp/msmtp.log +logfile $XDG_CONFIG_HOME/msmtp/msmtp.log " msmtp_profile="account $title host $smtp @@ -59,8 +59,8 @@ CertificateFile $sslcert MaildirStore $title-local Subfolders Verbatim -Path ~/.local/share/mail/$title/ -Inbox ~/.local/share/mail/$title/INBOX +Path $XDG_DATA_HOME/mail/$title/ +Inbox $XDG_DATA_HOME/mail/$title/INBOX Flatten . Channel $title From d60d2398869796ee1fd7e6c424afe11654e2e702 Mon Sep 17 00:00:00 2001 From: Jonassenher Date: Sun, 30 Aug 2020 19:02:15 +0200 Subject: [PATCH 020/225] Fixed the case for no environmental variables --- bin/mw | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/mw b/bin/mw index fffc965..5e5a610 100755 --- a/bin/mw +++ b/bin/mw @@ -38,7 +38,7 @@ msmtp_header="defaults auth on tls on tls_trust_file $sslcert -logfile $XDG_CONFIG_HOME/msmtp/msmtp.log +logfile ${XDG_CONFIG_HOME/:-$HOME/.config}/msmtp/msmtp.log " msmtp_profile="account $title host $smtp @@ -59,8 +59,8 @@ CertificateFile $sslcert MaildirStore $title-local Subfolders Verbatim -Path $XDG_DATA_HOME/mail/$title/ -Inbox $XDG_DATA_HOME/mail/$title/INBOX +Path ${XDG_DATA_HOME:-$HOME/.local/share}/mail/$title/ +Inbox ${XDG_DATA_HOME:-$HOME/.local/share}/mail/$title/INBOX Flatten . Channel $title From f00fa04f15c479dd32dbd9802602f6adbcefbbed Mon Sep 17 00:00:00 2001 From: Jonassenher Date: Sun, 30 Aug 2020 19:26:10 +0200 Subject: [PATCH 021/225] Fixed mbsync using the correct rc file --- bin/mw | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/mw b/bin/mw index 5e5a610..c0c6f7a 100755 --- a/bin/mw +++ b/bin/mw @@ -10,11 +10,11 @@ command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2" ! command -v mbsync >/dev/null && printf "\`mbsync (isync package)\` must be installed to run mutt-wizard.\\n" && exit prefix="/usr/local" -muttdir="${XDG_CONFIG_HOME:-$HOME/.config}/mutt" # Main mutt config location -accdir="$muttdir/accounts" # Directory for account settings +muttdir="${XDG_CONFIG_HOME:-$HOME/.config}/mutt" # Main mutt config location +accdir="$muttdir/accounts" # Directory for account settings maildir="${XDG_DATA_HOME:-$HOME/.local/share}/mail" # Location of mail storage -namere="^[a-z_][a-z0-9_-]*$" # Regex to ensure viable username -emailre=".+@.+\..+" # Regex to confirm valid email address +namere="^[a-z_][a-z0-9_-]*$" # Regex to ensure viable username +emailre=".+@.+\..+" # Regex to confirm valid email address muttshare="$prefix/share/mutt-wizard" mbsyncrc="${MBSYNCRC_HOME:-$HOME/.mbsyncrc}" mwconfig="$muttshare/mutt-wizard.muttrc" @@ -22,6 +22,7 @@ cachedir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard" muttrc="$muttdir/muttrc" msmtprc="${XDG_CACHE_HOME:-$HOME/.config}/msmtp/config" ssltype="IMAPS" # This is later changed to `None` later in the script if using Protonmail +alias mbsync='mbsync -c "$mbsyncrc"' for x in "/etc/ssl/certs/ca-certificates.crt" "/etc/pki/tls/certs/ca-bundle.crt" "/etc/ssl/ca-bundle.pem" "/etc/pki/tls/cacert.pem" "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem" "/etc/ssl/cert.pem" "/usr/local/share/ca-certificates/" do From 8b1ba846d03009e4e771725727856f58be1c33cf Mon Sep 17 00:00:00 2001 From: Jonassenher Date: Sun, 30 Aug 2020 21:22:35 +0200 Subject: [PATCH 022/225] fix --- bin/mw | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/mw b/bin/mw index c0c6f7a..57fd7b5 100755 --- a/bin/mw +++ b/bin/mw @@ -20,7 +20,7 @@ mbsyncrc="${MBSYNCRC_HOME:-$HOME/.mbsyncrc}" mwconfig="$muttshare/mutt-wizard.muttrc" cachedir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard" muttrc="$muttdir/muttrc" -msmtprc="${XDG_CACHE_HOME:-$HOME/.config}/msmtp/config" +msmtprc="${XDG_CONFIG_HOME:-$HOME/.config}/msmtp/config" ssltype="IMAPS" # This is later changed to `None` later in the script if using Protonmail alias mbsync='mbsync -c "$mbsyncrc"' @@ -193,7 +193,7 @@ EOF echo "$maxmes" | grep "[1-9]" >/dev/null || maxmes="0" getpass getprofiles - mkdir -p "$muttdir" "$accdir" "$cachedir/$title/bodies" "$HOME/.config/msmtp" + mkdir -p "$muttdir" "$accdir" "$cachedir/$title/bodies" "${XDG_CONFIG_HOME:-$HOME/.config}/msmtp" getaccounts for x in $(seq 1 9); do echo "$accounts" | grep "$x" >/dev/null 2>&1 || { export idnum="$x"; break ;}; done [ ! -f "$msmtprc" ] && echo "$msmtp_header" > "$msmtprc" @@ -203,6 +203,7 @@ EOF protonmail.ch|protonmail.com|pm.me) protonfinger || return 1 ;; esac echo "$mutt_profile" > "$accdir/$idnum-$title.muttrc" + mkdir -p "${mbsyncrc%/*}" echo "$mbsync_profile" >> "$mbsyncrc" notmuchauto [ ! -f "$muttrc" ] && echo "# vim: filetype=neomuttrc" > "$muttrc" && echo "muttrc created." @@ -289,7 +290,7 @@ asktype() { while : ; do esac; done ;} purge() { confirm "delete all account data" || exit - rm -rf "$mbsyncrc" "$accdir" "$HOME/.config/msmtp" "$cachedir" + rm -rf "$mbsyncrc" "$accdir" "${XDG_CONFIG_HOME:-$HOME/.config}/msmtp" "$cachedir" echo "All configs and account settings have been purged." sed -ibu "/\# mw-autogenerated/d" "$muttrc" ; rm -f "$muttrc"bu } From 113499cf740a7a4473ac33414ec833d4fd9c9633 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Mon, 31 Aug 2020 16:57:19 -0400 Subject: [PATCH 023/225] tweaks --- bin/mw | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/mw b/bin/mw index 57fd7b5..ca090c3 100755 --- a/bin/mw +++ b/bin/mw @@ -16,11 +16,12 @@ maildir="${XDG_DATA_HOME:-$HOME/.local/share}/mail" # Location of mail storage namere="^[a-z_][a-z0-9_-]*$" # Regex to ensure viable username emailre=".+@.+\..+" # Regex to confirm valid email address muttshare="$prefix/share/mutt-wizard" -mbsyncrc="${MBSYNCRC_HOME:-$HOME/.mbsyncrc}" +mbsyncrc="${MBSYNCRC:-$HOME/.mbsyncrc}" mwconfig="$muttshare/mutt-wizard.muttrc" cachedir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard" muttrc="$muttdir/muttrc" msmtprc="${XDG_CONFIG_HOME:-$HOME/.config}/msmtp/config" +msmtplog="${XDG_CONFIG_HOME:-$HOME/.config}/msmtp/msmtp.log" ssltype="IMAPS" # This is later changed to `None` later in the script if using Protonmail alias mbsync='mbsync -c "$mbsyncrc"' @@ -39,7 +40,7 @@ msmtp_header="defaults auth on tls on tls_trust_file $sslcert -logfile ${XDG_CONFIG_HOME/:-$HOME/.config}/msmtp/msmtp.log +logfile $msmtplog " msmtp_profile="account $title host $smtp @@ -328,7 +329,7 @@ case "$1" in add) asktype && askinfo && tryconnect && finalize || delete ;; pass) pick "change the password of" && getpass ;; delete) pick delete && confirm "delete the \`$title\` profile" && delete ;; - sync) syncwrapper $2 ;; + sync) syncwrapper "$2" ;; purge) purge ;; *) cat << EOF mw: mutt-wizard, auto-configure email accounts for mutt From 289533279b21f0fc6ecbdf03ebde2a67741e3ded Mon Sep 17 00:00:00 2001 From: Ethan Rietz Date: Wed, 2 Sep 2020 08:11:22 -0400 Subject: [PATCH 024/225] Update domains.csv (#519) Co-authored-by: Luke Smith --- share/domains.csv | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/share/domains.csv b/share/domains.csv index 9db3601..6735872 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -126,6 +126,7 @@ interia.*,poczta.interia.pl,993,poczta.interia.pl,465 inventati.org,mail.autistici.org,993,smtp.autistici.org,465 ionos.de,imap.ionos.de,993,smtp.ionos.de,587 itu.dk,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 +iu.edu,imap.exchange.iu.edu,993,mail-relay.iu.edu,587 kean.edu,imap.gmail.com,993,smtp.gmail.com,587 kipras.org,mail.kipras.org,993,mail.kipras.org,587 krutt.org,mail.autistici.org,993,smtp.autistici.org,465 @@ -264,4 +265,4 @@ yandex.*,imap.yandex.com,993,smtp.yandex.com,587 ymail.com,imap.mail.yahoo.com,993,smtp.mail.yahoo.com,465 zaclys.net,mail.zaclys.net,993,mail.zaclys.net,465 zoho.com,imap.zoho.com,993,smtp.zoho.com,465 -zohomail.eu,imap.zoho.eu,993,smtp.zoho.eu,465 +zohomail.eu,imap.zoho.eu,993,smtp.zoho.eu,465 \ No newline at end of file From 032077adf6a7f7d56b48df5c4f879b207155dd55 Mon Sep 17 00:00:00 2001 From: "A. Tammy" Date: Sun, 6 Sep 2020 15:58:53 -0400 Subject: [PATCH 025/225] fix notmuch integration caller command (#520) Co-authored-by: Aisha Tammy --- 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 e7fa8c8..c3dae24 100644 --- a/share/mutt-wizard.muttrc +++ b/share/mutt-wizard.muttrc @@ -71,7 +71,7 @@ bind editor complete-query 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 "mbsync -a" "run mbsync to sync all mail" -macro index \Cf "unset wait_keyread -p 'Enter a search term to find with notmuch: ' 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_keyread x?'Enter a search term to find with notmuch: '; 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)" # Sidebar mappings From 95cf003c036dd95000ab80ca6c680dab2e3ca092 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sun, 6 Sep 2020 16:00:58 -0400 Subject: [PATCH 026/225] larbs address added --- share/domains.csv | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/share/domains.csv b/share/domains.csv index 6735872..cfda62c 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -132,6 +132,7 @@ kipras.org,mail.kipras.org,993,mail.kipras.org,587 krutt.org,mail.autistici.org,993,smtp.autistici.org,465 kth.se,webmail.kth.se,993,smtp.kth.se,587 lavabit.com,lavabit.com,993,lavabit.com,587 +larbs.xyz,mail.larbs.xyz,993,mail.larbs.xyz,587 librem.one,imap.librem.one,993,smtp.librem.one,465 linuxmail.org,imap.mail.com,993,smtp.mail.com,587 live.com,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 @@ -265,4 +266,4 @@ yandex.*,imap.yandex.com,993,smtp.yandex.com,587 ymail.com,imap.mail.yahoo.com,993,smtp.mail.yahoo.com,465 zaclys.net,mail.zaclys.net,993,mail.zaclys.net,465 zoho.com,imap.zoho.com,993,smtp.zoho.com,465 -zohomail.eu,imap.zoho.eu,993,smtp.zoho.eu,465 \ No newline at end of file +zohomail.eu,imap.zoho.eu,993,smtp.zoho.eu,465 From 50ae4af96738e32e6a7ebdd04641b4fdaa3d30f8 Mon Sep 17 00:00:00 2001 From: Nicholas <39540565+NicholasDefranco@users.noreply.github.com> Date: Tue, 8 Sep 2020 09:33:41 -0400 Subject: [PATCH 027/225] Added Seneca College to domains.csv (#521) --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index cfda62c..3e8eb80 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -158,6 +158,7 @@ mortemale.org,mail.autistici.org,993,smtp.autistici.org,465 msn.com,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 muny.us,mail.muny.us,993,mail.muny.us,465 myself.com,imap.mail.com,993,smtp.mail.com,587 +myseneca.ca,outlook.office365.com,993,outlook.office365.com,587 narod.ru,imap.yandex.com,993,smtp.yandex.com,587 national.shitposting.agency,mail.cock.li,993,mail.cock.li,587 ncsu.edu,imap.gmail.com,993,smtp.gmail.com,587 From 90de356b8aa89a52f2cf8ca2b23607189616ab84 Mon Sep 17 00:00:00 2001 From: beldi961 <55185525+beldi961@users.noreply.github.com> Date: Wed, 9 Sep 2020 15:02:24 +0200 Subject: [PATCH 028/225] =?UTF-8?q?Added=20Friedrich-Schiller-Universit?= =?UTF-8?q?=C3=A4t=20Jena=20(#522)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index 3e8eb80..4a77edd 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -237,6 +237,7 @@ ua.pt,outlook.office365.com,993,mail.ua.pt,25 uach.mx,imap.gmail.com,993,smtp.gmail.com,587 ucdavis.edu,imap.gmail.com,993,smtp.gmail.com,587 uni-duesseldorf.de,mail.hhu.de,993,mail.hhu.de,465 +uni-jena.de,imap.uni-jena.de,993,smtp.uni-jena.de,587 unilodz.eu,outlook.office365.com,993,smtp.office365.com,587 unitybox.de,mail.unity-mail.de,993,mail.unity-mail.de,587 univ-ubs.fr,partage.univ-ubs.fr,993,partage.univ-ubs.fr,587 From 5076fa59e3bc6f56ae81c963c18e2186762ef08d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Povoln=C3=BD?= Date: Sun, 13 Sep 2020 19:42:20 +0200 Subject: [PATCH 029/225] added seznam.cz and FEEC BUT mail (#524) added settings for Czech mail provider seznam.cz and a faculty e-mail for Faculty of Electrical Engineering and Communication, Brno University of Technology --- share/domains.csv | 2 ++ 1 file changed, 2 insertions(+) diff --git a/share/domains.csv b/share/domains.csv index 4a77edd..800c2d6 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -200,12 +200,14 @@ rmcacs.org,imap.gmail.com,993,smtp.gmail.com,587 runbox.com,mail.runbox.com,993,mail.runbox.com,587 rwth-aachen.de,mail.rwth-aachen.de,993,mail.rwth-aachen.de,587 sapo.pt,imap.sapo.pt,993,smtp.sapo.pt,587 +seznam.cz,imap.seznam.cz,993,smtp.seznam.cz,465 smail.inf.h-brs.de,imap.inf.h-brs.de,993,smtp.inf.h-brs.de,587 southwales.ac.uk,imap.gmail.com,993,smtp.gmail.com,587 spoko.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465 st.amu.edu.pl,outlook.office365.com,993,smtp.office365.com,587 stevens.edu,imap.outlook.com,993,smtp.outlook.com,587 stronzi.org,mail.autistici.org,993,smtp.autistici.org,465 +stud.feec.vutbr.cz,imap.stud.feec.vutbr.cz,993,smtp.stud.feec.vutbr.cz,587 stud.tu-darmstadt.de,imap.stud.tu-darmstadt.de,993,smtp.tu-darmstadt.de,465 stud.uis.no,outlook.office365.com,993,smtp.office365.com,587 stud.uni-bamberg.de,outlook.office365.com,993,smtp.office365.com,587 From dba3bcf9e6eb1ba96c3fe010863093f207e6e5ec Mon Sep 17 00:00:00 2001 From: qorg11 Date: Wed, 16 Sep 2020 22:12:21 +0200 Subject: [PATCH 030/225] modified vxempire for TLS ports (instead of STARTTLS) --- share/domains.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/domains.csv b/share/domains.csv index 800c2d6..b0c68ed 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -255,7 +255,7 @@ vip.onet.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465 vivaldi.net,imap.vivaldi.net,993,smtp.vivaldi.net,587 vp.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465 vt.edu,imap.gmail.com,993,smtp.gmail.com,587 -vxempire.xyz,vxempire.xyz,993,vxempire.xyz,587 +vxempire.xyz,vxempire.xyz,993,vxempire.xyz,465 waifu.club,mail.cock.li,993,mail.cock.li,587 wanadoo.fr,imap.orange.fr,993,smtp.orange.fr,465 wants.dicksinhisan.us,mail.cock.li,993,mail.cock.li,587 From 7f4897aae1775ba7dacd184f4b86604e86d34a89 Mon Sep 17 00:00:00 2001 From: qorg11 Date: Wed, 16 Sep 2020 22:14:44 +0200 Subject: [PATCH 031/225] modified vxempire for TLS ports (instead of STARTTLS) (#525) --- share/domains.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/domains.csv b/share/domains.csv index 800c2d6..b0c68ed 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -255,7 +255,7 @@ vip.onet.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465 vivaldi.net,imap.vivaldi.net,993,smtp.vivaldi.net,587 vp.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465 vt.edu,imap.gmail.com,993,smtp.gmail.com,587 -vxempire.xyz,vxempire.xyz,993,vxempire.xyz,587 +vxempire.xyz,vxempire.xyz,993,vxempire.xyz,465 waifu.club,mail.cock.li,993,mail.cock.li,587 wanadoo.fr,imap.orange.fr,993,smtp.orange.fr,465 wants.dicksinhisan.us,mail.cock.li,993,mail.cock.li,587 From 052afead8793d83f7d1a53d503ef0d5abebf224a Mon Sep 17 00:00:00 2001 From: Corey Stephan <54367850+historical-theology@users.noreply.github.com> Date: Fri, 18 Sep 2020 07:25:27 -0500 Subject: [PATCH 032/225] Add Marquette University (fn.ln@marquette.edu) (#526) --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index b0c68ed..a06e486 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -151,6 +151,7 @@ mailbox.org,imap.mailbox.org,993,smtp.mailbox.org,587 mailbox.tu-dresden.de,msx.tu-dresden.de,993,msx.tu-dresden.de,587 mailfence.com,imap.mailfence.com,993,smtp.mailfence.com,465 mailo.com,mail.mailo.com,993,mail.mailo.com,465 +marquette.edu,outlook.office365.com,993,smtp.office365.com,587 memeware.net,mail.cock.li,993,mail.cock.li,587 metu.edu.tr,imap.metu.edu.tr,993,smtp.metu.edu.tr,465 ml1.net,imap.fastmail.com,993,smtp.fastmail.com,465 From faa5f2aad9daa9fafc80df96968cff1ebbda06f8 Mon Sep 17 00:00:00 2001 From: Laura Powles Date: Sat, 26 Sep 2020 19:40:56 +1000 Subject: [PATCH 033/225] changed the prefix for password files into a variable so that it can be edited more easily --- bin/mw | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bin/mw b/bin/mw index ca090c3..f501638 100755 --- a/bin/mw +++ b/bin/mw @@ -10,6 +10,7 @@ command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2" ! command -v mbsync >/dev/null && printf "\`mbsync (isync package)\` must be installed to run mutt-wizard.\\n" && exit prefix="/usr/local" +pass_prefix="mutt-wizard-" muttdir="${XDG_CONFIG_HOME:-$HOME/.config}/mutt" # Main mutt config location accdir="$muttdir/accounts" # Directory for account settings maildir="${XDG_DATA_HOME:-$HOME/.local/share}/mail" # Location of mail storage @@ -47,14 +48,14 @@ host $smtp port $sport from $fulladdr user $login -passwordeval \"pass mutt-wizard-$title\" +passwordeval \"pass $pass_prefix$title\" $starttlsoff " mbsync_profile="IMAPStore $title-remote Host $imap Port $iport User $login -PassCmd \"pass mutt-wizard-$title\" +PassCmd \"pass $pass_prefix$title\" AuthMechs LOGIN SSLType $ssltype CertificateFile $sslcert @@ -108,7 +109,7 @@ set folder = \"imaps://$login@$imap:$iport\" set imap_user = \"$login\" set header_cache = $cachedir/$title/headers set message_cachedir = $cachedir/$title/bodies -set imap_pass = \"\`pass mutt-wizard-$title\`\" +set imap_pass = \"\`pass $pass_prefix$title\`\" set mbox_type = Maildir set ssl_starttls = yes @@ -218,8 +219,8 @@ protonfinger() { printf "Getting Protonmail bridge fingerprint...\\n" sed -ibu "s/account $title/&\ntls_trust_file\ntls_fingerprint $fingerprint/" "$msmtprc" ; rm -f "$msmtprc"bu } -getpass() { while : ; do pass rm -f "mutt-wizard-$title" >/dev/null 2>&1 - pass insert "mutt-wizard-$title" && break; done ;} +getpass() { while : ; do pass rm -f "$pass_prefix$title" >/dev/null 2>&1 + pass insert "$pass_prefix$title" && break; done ;} formatShortcut() { \ while read -r data; do { echo "macro index,pager g$1 \"$data\" \"go to $2\" # mw-autogenerated" From ff4e648878d973dcb0842ae36b62dc1c4129a3fe Mon Sep 17 00:00:00 2001 From: johngodlee Date: Sun, 27 Sep 2020 19:59:23 +0100 Subject: [PATCH 034/225] Update domains.csv --- share/domains.csv | 2 ++ 1 file changed, 2 insertions(+) diff --git a/share/domains.csv b/share/domains.csv index a06e486..7c37f76 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -272,3 +272,5 @@ ymail.com,imap.mail.yahoo.com,993,smtp.mail.yahoo.com,465 zaclys.net,mail.zaclys.net,993,mail.zaclys.net,465 zoho.com,imap.zoho.com,993,smtp.zoho.com,465 zohomail.eu,imap.zoho.eu,993,smtp.zoho.eu,465 +sms.ed.ac.uk,pod51015.outlook.com,993,pod51015.outlook.com,587 + From d58b0d82f29f07a118fa74fe53d814f04c86ac89 Mon Sep 17 00:00:00 2001 From: LazyBvr <16289763+LazyBvr@users.noreply.github.com> Date: Tue, 29 Sep 2020 02:32:45 +0200 Subject: [PATCH 035/225] Update domains.csv Add Jagiellonian University student email. --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index a06e486..70b247b 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -216,6 +216,7 @@ student.binadarma.ac.id,imap.gmail.com,993,smtp.gmail.com,587 student.ethz.ch,mail.ethz.ch,993,mail.ethz.ch,587 student.rmit.edu.au,outlook.office365.com,993,smtp.office365.com,587 student.tuwien.ac.at,mail.student.tuwien.ac.at,993,mail.student.tuwien.ac.at,587 +student.uj.edu.pl,outlook.office365.com,993,smtp.office365.com,587 student.utwente.nl,imap.gmail.com,993,smtp.gmail.com,587 studenti.unipi.it,outlook.office365.com,993,smtp.office365.com,587 students.rmcacs.org,imap.gmail.com,993,smtp.gmail.com,587 From 264c623340d148799675e85e86204c848394d921 Mon Sep 17 00:00:00 2001 From: nebulaeandstars <53393049+nebulaeandstars@users.noreply.github.com> Date: Thu, 1 Oct 2020 06:29:16 +1000 Subject: [PATCH 036/225] Add anu.edu.au (#529) * added anu.edu.au * found/fixed an out-of-place domain --- share/domains.csv | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/share/domains.csv b/share/domains.csv index a06e486..05a7f21 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -14,6 +14,7 @@ alumnidirector.com,imap.mail.com,993,smtp.mail.com,587 alunos.utfpr.edu.br,imap.gmail.com,993,smtp.gmail.com,587 anche.no,mail.autistici.org,993,smtp.autistici.org,465 angelic.com,imap.mail.com,993,smtp.mail.com,587 +anu.edu.au,outlook.office365.com,993,smtp.office365.com,587 aol.com,imap.aol.com,993,smtp.aol.com,465 appraiser.net,imap.mail.com,993,smtp.mail.com,587 aquilenet.fr,imap.aquilenet.fr,993,smtp.aquilenet.fr,587 @@ -131,8 +132,8 @@ kean.edu,imap.gmail.com,993,smtp.gmail.com,587 kipras.org,mail.kipras.org,993,mail.kipras.org,587 krutt.org,mail.autistici.org,993,smtp.autistici.org,465 kth.se,webmail.kth.se,993,smtp.kth.se,587 -lavabit.com,lavabit.com,993,lavabit.com,587 larbs.xyz,mail.larbs.xyz,993,mail.larbs.xyz,587 +lavabit.com,lavabit.com,993,lavabit.com,587 librem.one,imap.librem.one,993,smtp.librem.one,465 linuxmail.org,imap.mail.com,993,smtp.mail.com,587 live.com,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 From bf28f165a045ce3714701c6e9dc91597317e51fd Mon Sep 17 00:00:00 2001 From: qorg11 Date: Fri, 2 Oct 2020 11:10:39 +0200 Subject: [PATCH 037/225] Add kalli.st to domains.csv --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index b0c68ed..347c869 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -127,6 +127,7 @@ inventati.org,mail.autistici.org,993,smtp.autistici.org,465 ionos.de,imap.ionos.de,993,smtp.ionos.de,587 itu.dk,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 iu.edu,imap.exchange.iu.edu,993,mail-relay.iu.edu,587 +kalli.st,mail.kalli.st,993,kalli.st,587 kean.edu,imap.gmail.com,993,smtp.gmail.com,587 kipras.org,mail.kipras.org,993,mail.kipras.org,587 krutt.org,mail.autistici.org,993,smtp.autistici.org,465 From 9cd26a24959ac339f44b6cde6195116a9f1e6656 Mon Sep 17 00:00:00 2001 From: f380cedric Date: Mon, 5 Oct 2020 11:30:58 +0200 Subject: [PATCH 038/225] Use POSIX-compliant read Rewrite #520. Using `read var?'prompt'` is wrong. It is ksh (and zsh) specific. Using `read -p 'prompt' var` is also wrong. It is bash specific. Since we cannot assume which sh is implemented, we should write POSIX-compliant code. --- 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 c3dae24..57df579 100644 --- a/share/mutt-wizard.muttrc +++ b/share/mutt-wizard.muttrc @@ -71,7 +71,7 @@ bind editor complete-query 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 "mbsync -a" "run mbsync to sync all mail" -macro index \Cf "unset wait_keyread x?'Enter a search term to find with notmuch: '; 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/\\+/\\\\+/ for@a;print@a' \`\"" "show only messages matching a notmuch pattern" macro index A "all\n" "show all messages (undo limit)" # Sidebar mappings From a60f5e7fb6609cb8d6c9bd6f32e20c7d744fd0fd Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Tue, 6 Oct 2020 11:42:28 -0400 Subject: [PATCH 039/225] some simplifications and soydevery removed --- bin/mw | 52 +++++++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/bin/mw b/bin/mw index ca090c3..3936b16 100755 --- a/bin/mw +++ b/bin/mw @@ -23,6 +23,7 @@ muttrc="$muttdir/muttrc" msmtprc="${XDG_CONFIG_HOME:-$HOME/.config}/msmtp/config" msmtplog="${XDG_CONFIG_HOME:-$HOME/.config}/msmtp/msmtp.log" ssltype="IMAPS" # This is later changed to `None` later in the script if using Protonmail +MARKER="# mw-autogenerated" alias mbsync='mbsync -c "$mbsyncrc"' for x in "/etc/ssl/certs/ca-certificates.crt" "/etc/pki/tls/certs/ca-bundle.crt" "/etc/ssl/ca-bundle.pem" "/etc/pki/tls/cacert.pem" "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem" "/etc/ssl/cert.pem" "/usr/local/share/ca-certificates/" @@ -208,9 +209,9 @@ EOF echo "$mbsync_profile" >> "$mbsyncrc" notmuchauto [ ! -f "$muttrc" ] && echo "# vim: filetype=neomuttrc" > "$muttrc" && echo "muttrc created." - ! grep "^source.*mutt-wizard.muttrc" "$muttrc" >/dev/null && echo "source $mwconfig # mw-autogenerated" >> "$muttrc" - ! grep "^source.*.muttrc" "$muttrc" | grep -v "$mwconfig" >/dev/null && echo "source $accdir/$idnum-$title.muttrc # mw-autogenerated" >> "$muttrc" - echo "macro index,pager i$idnum 'source $accdir/$idnum-$title.muttrc!;' \"switch to $fulladdr\" # mw-autogenerated" >> "$muttrc" + ! grep "^source.*mutt-wizard.muttrc" "$muttrc" >/dev/null && echo "source $mwconfig $MARKER" >> "$muttrc" + ! grep "^source.*.muttrc" "$muttrc" | grep -v "$mwconfig" >/dev/null && echo "source $accdir/$idnum-$title.muttrc $MARKER" >> "$muttrc" + echo "macro index,pager i$idnum 'source $accdir/$idnum-$title.muttrc!;' \"switch to $fulladdr\" $MARKER" >> "$muttrc" } protonfinger() { printf "Getting Protonmail bridge fingerprint...\\n" @@ -221,11 +222,14 @@ protonfinger() { printf "Getting Protonmail bridge fingerprint...\\n" getpass() { while : ; do pass rm -f "mutt-wizard-$title" >/dev/null 2>&1 pass insert "mutt-wizard-$title" && break; done ;} -formatShortcut() { \ - while read -r data; do { echo "macro index,pager g$1 \"$data\" \"go to $2\" # mw-autogenerated" - echo "macro index,pager M$1 \";$data\" \"move mail to $2\" # mw-autogenerated" - echo "macro index,pager C$1 \";$data\" \"copy mail to $2\" # mw-autogenerated"; } >> "$accdir/$idnum-$title.muttrc" - done ;} +formatShortcut() { toappend="$toappend +macro index,pager g$1 \"=$3\" \"go to $2\" $MARKER +macro index,pager M$1 \";=$3\" \"move mail to $2\" $MARKER +macro index,pager C$1 \";=$3\" \"copy mail to $2\" $MARKER" >> "$accdir/$idnum-$title.muttrc" +} + +setBox() { toappend="$toappend +set $1 = \"+$2\" $MARKER" ;} tryconnect() { mkdir -p "$maildir/$title" if mailboxes="$(mbsync -l "$title" | sed 's/\//./')" >/dev/null 2>&1 && [ -n "$mailboxes" ]; then @@ -239,25 +243,23 @@ tryconnect() { mkdir -p "$maildir/$title" fi ;} finalize() { \ - boxes="$(find "$maildir/$title/" -mindepth 1 -type d | sed "s/\ /\\\ /g;s/^.*\//=/;/=\(cur\|new\|tmp\)$/d")" + boxes="$(find "$maildir/$title/" -mindepth 1 -type d | sed "s/\ /\\\ /g;s/^.*\///;/\(cur\|new\|tmp\)$/d")" [ -z "$boxes" ] && printf "\033[31mNo local mailboxes have been detected for %s.\033[0m\\nThis means that mbsync has not been successfully run.\\nRun mbsync, and if it has an error, be sure to check your password and server settings manually if needbe.\\n" "$title" && return printf "Setting default mailboxes for your Inbox, Sent, Drafts and Trash in mutt...\\n" - spoolfile=$(echo "$boxes" | grep -i -m 1 inbox | sed 's/=/+/g') - record=$(echo "$boxes" | grep -i -m 1 sent | sed 's/=/+/g') - postponed=$(echo "$boxes" | grep -i -m 1 draft | sed 's/=/+/g') - trash=$(echo "$boxes" | grep -i -m 1 trash | sed 's/=/+/g') - sed -ibu "/^mailboxes\|^set record\|^set postponed\|^set trash\|^set spoolfile/d" "$accdir/$idnum-$title.muttrc" ; rm -f "$accdir/$idnum-$title.muttrcbu" - { echo "set spoolfile = \"$spoolfile\""; echo "set record = \"$record\""; echo "set postponed = \"$postponed\""; echo "set trash = \"$trash\""; } >> "$accdir/$idnum-$title.muttrc" - echo "mailboxes $(echo "$boxes" | sed -e "s/^\|$/\"/g" | tr "\n" " ")" >> "$accdir/$idnum-$title.muttrc" + sed -ibu "/$MARKER/d" "$accdir/$idnum-$title.muttrc" ; rm -f "$accdir/$idnum-$title.muttrcbu" + toappend="mailboxes $(echo "$boxes" | sed "s/^/\"=/;s/$/\"/" | paste -sd ' ' )" + for x in $boxes; do + case $x in + *[Ii][Nn][Bb][Oo][Xx]*) formatShortcut i inbox "$x"; setBox spoolfile "$x" ;; + *[Ss][Ee][Nn][Tt]*) setBox record "$x"; formatShortcut s sent "$x" ;; + *[Dd][Rr][Aa][Ff][Tt][Ss]*) setBox postponed "$x"; formatShortcut d drafts "$x" ;; + *[Tt][Rr][Aa][Ss][Hh]*|*[Jj][Uu][Nn][Kk]*) formatShortcut t trash "$x"; setBox trash "$x" ;; + *[Aa][Rr][Cc][Hh][Ii][Vv][Ee]*) formatShortcut a archive "$x" ;; + *[Ss][Pp][Aa][Mm]*) formatShortcut S spam "$x" ;; + esac + done printf "Setting up your keyboard shortcuts for jumping between mailboxes...\\n" - sed -ibu "/# mw-autogenerated/d" "$accdir/$idnum-$title.muttrc" ; rm -f "$accdir/$idnum-$title.muttrcbu" - echo "$boxes" | grep -i inbox | head -n 1 | formatShortcut i inbox - echo "$boxes" | grep -i sent | head -n 1 | formatShortcut s sent - echo "$boxes" | grep -i draft | head -n 1 | formatShortcut d drafts - echo "$boxes" | grep -i trash | head -n 1 | formatShortcut t trash - echo "$boxes" | grep -i spam | head -n 1 | formatShortcut S spam - echo "$boxes" | grep -i junk | head -n 1 | formatShortcut j junk - echo "$boxes" | grep -i archive | head -n 1 | formatShortcut a archive + echo "$toappend" >> "$accdir/$idnum-$title.muttrc" [ "$accounttype" = "offline" ] && printf "All done.\\n\033[33mYou should now be able to run \`\033[32mmbsync %s\033[33m\` to begin to download your mail.\033[0m\\n" "$title" command -V urlview >/dev/null 2>&1 && [ ! -f "$HOME/.urlview" ] && echo "COMMAND \$BROWSER" > "$HOME/.urlview" return 0 @@ -293,7 +295,7 @@ asktype() { while : ; do purge() { confirm "delete all account data" || exit rm -rf "$mbsyncrc" "$accdir" "${XDG_CONFIG_HOME:-$HOME/.config}/msmtp" "$cachedir" echo "All configs and account settings have been purged." - sed -ibu "/\# mw-autogenerated/d" "$muttrc" ; rm -f "$muttrc"bu + sed -ibu "/$MARKER/d" "$muttrc" ; rm -f "$muttrc"bu } syncwrapper() { mbsync "${1:--a}" & From 3135132f64bbe6b9f75f5a0b19168656ccd3a6ff Mon Sep 17 00:00:00 2001 From: ccmywish Date: Thu, 8 Oct 2020 13:58:40 +0800 Subject: [PATCH 040/225] Add qq,126,163 mail for chinese users --- share/domains.csv | 3 +++ 1 file changed, 3 insertions(+) diff --git a/share/domains.csv b/share/domains.csv index 0fd4c83..22596e4 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -1,4 +1,6 @@ ADDRESS,IMAP,imap port,SMTP,smtp port +126.com,imap.126.com,993,smtp.126.com,587 +163.com,imap.163.com,993,smtp.163.com,587 420blaze.it,mail.cock.li,993,mail.cock.li,587 8chan.co,mail.cock.li,993,mail.cock.li,587 aaathats3as.com,mail.cock.li,993,mail.cock.li,587 @@ -195,6 +197,7 @@ privacyrequired.com,mail.autistici.org,993,smtp.autistici.org,465 prokonto.pl,poczta.o2.pl,993,poczta.o2.pl,465 protonmail.ch,127.0.0.1,1143,127.0.0.1,1025 protonmail.com,127.0.0.1,1143,127.0.0.1,1025 +qq.com,imap.qq.com,993,smtp.qq.com,587 rape.lol,mail.cock.li,993,mail.cock.li,587 redchan.it,mail.cock.li,993,mail.cock.li,587 resch.pw,mail.resch.pw,993,mail.resch.pw,587 From 71abb874a01e04532c33b13ff2caf78c60e1250f Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 8 Oct 2020 18:12:53 -0400 Subject: [PATCH 041/225] fix --- share/domains.csv | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/share/domains.csv b/share/domains.csv index 0fd4c83..115fd19 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -205,6 +205,7 @@ rwth-aachen.de,mail.rwth-aachen.de,993,mail.rwth-aachen.de,587 sapo.pt,imap.sapo.pt,993,smtp.sapo.pt,587 seznam.cz,imap.seznam.cz,993,smtp.seznam.cz,465 smail.inf.h-brs.de,imap.inf.h-brs.de,993,smtp.inf.h-brs.de,587 +sms.ed.ac.uk,pod51015.outlook.com,993,pod51015.outlook.com,587 southwales.ac.uk,imap.gmail.com,993,smtp.gmail.com,587 spoko.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465 st.amu.edu.pl,outlook.office365.com,993,smtp.office365.com,587 @@ -275,5 +276,3 @@ ymail.com,imap.mail.yahoo.com,993,smtp.mail.yahoo.com,465 zaclys.net,mail.zaclys.net,993,mail.zaclys.net,465 zoho.com,imap.zoho.com,993,smtp.zoho.com,465 zohomail.eu,imap.zoho.eu,993,smtp.zoho.eu,465 -sms.ed.ac.uk,pod51015.outlook.com,993,pod51015.outlook.com,587 - From 8f45a05115732d601551835236b5ba6c46cd4eca Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 8 Oct 2020 18:13:15 -0400 Subject: [PATCH 042/225] begin work for 3.0 --- bin/mw | 299 +++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 185 insertions(+), 114 deletions(-) diff --git a/bin/mw b/bin/mw index e44d580..e23e5a1 100755 --- a/bin/mw +++ b/bin/mw @@ -1,5 +1,20 @@ #!/bin/sh +debug() { + echo "fulladdr: $fulladdr" + echo "login: $login" + echo "title: $title" + echo "imap: $imap" + echo "iport: $iport" + echo "smtp: $smtp" + echo "sport: $sport" + echo "proton: $proton" + echo "tls: $tls" + echo "force: $force" + echo "online: $online" + echo "action: $action" +} + command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2" [ -z ${PASSWORD_STORE_DIR+x} ] && PASSWORD_STORE_DIR="$HOME/.password-store" [ -r "$PASSWORD_STORE_DIR/.gpg-id" ] && @@ -10,7 +25,7 @@ command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2" ! command -v mbsync >/dev/null && printf "\`mbsync (isync package)\` must be installed to run mutt-wizard.\\n" && exit prefix="/usr/local" -pass_prefix="mutt-wizard-" +pass_prefix="mw-" muttdir="${XDG_CONFIG_HOME:-$HOME/.config}/mutt" # Main mutt config location accdir="$muttdir/accounts" # Directory for account settings maildir="${XDG_DATA_HOME:-$HOME/.local/share}/mail" # Location of mail storage @@ -46,7 +61,7 @@ logfile $msmtplog " msmtp_profile="account $title host $smtp -port $sport +port ${sport:-587} from $fulladdr user $login passwordeval \"pass $pass_prefix$title\" @@ -54,7 +69,7 @@ $starttlsoff " mbsync_profile="IMAPStore $title-remote Host $imap -Port $iport +Port ${iport:-993} User $login PassCmd \"pass $pass_prefix$title\" AuthMechs LOGIN @@ -79,7 +94,7 @@ ExpireUnread no # End profile " -if [ "$accounttype" = "offline" ]; then +if [ -z "${online+x}" ]; then mutt_profile="# vim: filetype=neomuttrc # muttrc file for account $title set realname = \"$realname\" @@ -106,7 +121,7 @@ set realname = \"$realname\" set from = \"$fulladdr\" set sendmail = \"msmtp -a $title\" alias me $realname <$fulladdr> -set folder = \"imaps://$login@$imap:$iport\" +set folder = \"imaps://$login@$imap:${iport:-993}\" set imap_user = \"$login\" set header_cache = $cachedir/$title/headers set message_cachedir = $cachedir/$title/bodies @@ -127,92 +142,94 @@ fi printf "DONE.\\n" } +parsedomains(){ serverinfo="$(grep "^${fulladdr#*@}" "$muttshare/domains.csv" 2>/dev/null)" + + [ -z "$serverinfo" ] && + serverinfo="$(grep "$(echo "${fulladdr#*@}" | sed "s/\.[^\.]*$/\.\\\*/")" "$muttshare/domains.csv" 2>/dev/null)" + + IFS=, read -r service imapsugg iportsugg smtpsugg sportsugg </dev/null; do - printf "That is not a valid \033[31memail address\033[0m, please retype the desired email.\\n\\nEmail: \033[36m\t" + [ -z "$fulladdr" ] && echo "Give the full email address to add:" && + read -r fulladdr + + while ! echo "$fulladdr" | grep -qE "$emailre"; do + echo "\`$fulladdr\` is not a valid email address. Please retype the address:" read -r fulladdr - printf "\033[0m" done - domain="$(echo "$fulladdr" | sed "s/.*@//")" - search_query=$domain - case "$domain" in - protonmail.com|protonmail.ch|pm.me) - search_query='protonmail.com' ;; - *) - while : ; do - printf "\nIs your email hosted with Protonmail? [yes/no] " - read -r is_protonmail - case $is_protonmail in - [Yy][Ee][Ss]) search_query='protonmail.com' && break;; - [Nn][Oo]) break;; - *) printf 'Please answer Yes or No' - esac; done; - esac - printf "\\nSearching for \033[32m%s\033[0m in \033[34m\`domains.csv\`\033[0m..." "$domain" - serverinfo="$(grep "^$search_query" "$muttshare/domains.csv" 2>/dev/null)" - if [ -z "$serverinfo" ]; then - search_query=$(echo "$search_query" | sed "s/\.[^\.]*$/\.\\\*/") - serverinfo="$(grep "^$search_query" "$muttshare/domains.csv" 2>/dev/null)" - fi - if [ -z "$serverinfo" ]; then - printf "Your email domain is not in mutt-wizard's database yet.\\nmutt-wizard will still autoconfigure everything, but you will have to manually type in your service's IMAP and SMTP server information.\\nYou can usually quickly find this by internet searching for it.\\n" - printf "Insert the IMAP server for your email provider (excluding the port number)\\n\033[36m\t" - read -r imap - printf "\033[0mWhat is your server's IMAP port number? (Usually something like 993)\\n\033[36m\t" - read -r iport - printf "\033[0mInsert the SMTP server for your email provider (excluding the port number)\\n\033[36m\t" - read -r smtp - printf "\033[0mWhat is your server's SMTP port number? (Usually 587 or 465)\\n\033[36m\t" - read -r sport - printf "\033[0m\\nGreat! If you want to be helpful, copy the line below and you can add it to the \`domains.csv\` file on Github.\\nThis will make things easier for others who use your email provider.\\n\\n%s,%s,%s,%s,%s\\n\\nAlthough be sure to test to see if these settings work first! ;-)\\n" "$domain" "$imap" "$iport" "$smtp" "$sport" - else - IFS=, read -r service imap iport smtp sport </dev/null || ls "$accdir"/[0-9]"-$title.muttrc" >/dev/null 2>&1; do - printf "\033[31mTry again\033[0m. Pick a nickname that is one word only including lowercase letters and _ or - and that you have \033[1mnot\033[0m used before.\\n\tAccount name: \033[36m\t" - read -r title - printf "\033[0m" - done - printf "If your account has a special username different from your address, insert it now. Otherwise leave this prompt totally blank.\\n\033[34mMost accounts will not have a separate login, so you should probably leave this blank.\033[0m\\n\tLogin(?): \033[36m" - read -r login - printf "\033[0m" - [ -z "$login" ] && login="$fulladdr" - [ "$accounttype" = "offline" ] && printf "If you want to limit the number of messages kept offline to a number, enter that number below. If you do not want to limit your mail and would like \`mbsync\` to sync all mail, press enter without typing a number.\\n\t" && read -r maxmes - echo "$maxmes" | grep "[1-9]" >/dev/null || maxmes="0" + + [ -z "$realname" ] && echo "Give the name you would like to be identified by on the email account:" && + read -r realname + + title="$fulladdr" + #while ! echo "$title" | grep -q "$namere" || ls "$accdir"/[0-9]"-$title.muttrc" >/dev/null 2>&1; do + #printf "\033[31mTry again\033[0m. Pick a nickname that is one word only including lowercase letters and _ or - and that you have \033[1mnot\033[0m used before.\\n\tAccount name: \033[36m\t" + #read -r title + #printf "\033[0m" + #done + + [ -z "$login" ] && echo "Give the account log-on/username for this address:" && read -r login + login="${login:-$fulladdr}" + + + + #case "$service" in + #gmail.com) printf "\033[31mREMEMBER: Gmail users must enable \"less secure\" (third-party) applications first for the sync to work:\\nhttps://support.google.com/accounts/answer/6010255\\n\033[0m" ;; + #protonmail.ch|protonmail.com|pm.me) printf "\033[31mREMEMBER: Protonmail users must install and configure Protonmail Bridge first for the sync to work:\\nhttps://protonmail.com/bridge/\\n\033[0m" && ssltype="None" ;; + #esac + getpass +} + + +writeinfo() { + # Insert account information into variables. getprofiles - mkdir -p "$muttdir" "$accdir" "$cachedir/$title/bodies" "${XDG_CONFIG_HOME:-$HOME/.config}/msmtp" + + # Create required directories. + mkdir -p "$muttdir" "$accdir" "$cachedir/$title/bodies" "${XDG_CONFIG_HOME:-$HOME/.config}/msmtp" "$maildir/$title" + + # Get accounts and find the first missing account number (max. 9). getaccounts - for x in $(seq 1 9); do echo "$accounts" | grep "$x" >/dev/null 2>&1 || { export idnum="$x"; break ;}; done + for x in $(seq 1 9); do echo "$accounts" | grep -q "$x" || { export idnum="$x"; break ;}; done + + # Create msmtprc file if not present. [ ! -f "$msmtprc" ] && echo "$msmtp_header" > "$msmtprc" + + # Add account msmtp settings. echo "$msmtp_profile" >> "$msmtprc" + + # On Ubuntu/Debian, a link is needed since they use an older version. command -V apt-get >/dev/null 2>&1 && ln -s "$msmtprc" "$HOME/.msmtprc" 2>/dev/null - case "$service" in - protonmail.ch|protonmail.com|pm.me) protonfinger || return 1 ;; - esac + + # Create the individual mutt config file for the account. echo "$mutt_profile" > "$accdir/$idnum-$title.muttrc" + + # Create the mbsync config file. mkdir -p "${mbsyncrc%/*}" echo "$mbsync_profile" >> "$mbsyncrc" + + # Create a notmuch config file if not present already. notmuchauto + + # Create a basic muttrc is not present and source the mutt-wizard files + # and add the shortcuts to the account. [ ! -f "$muttrc" ] && echo "# vim: filetype=neomuttrc" > "$muttrc" && echo "muttrc created." - ! grep "^source.*mutt-wizard.muttrc" "$muttrc" >/dev/null && echo "source $mwconfig $MARKER" >> "$muttrc" - ! grep "^source.*.muttrc" "$muttrc" | grep -v "$mwconfig" >/dev/null && echo "source $accdir/$idnum-$title.muttrc $MARKER" >> "$muttrc" + ! grep -q "^source.*mutt-wizard.muttrc" "$muttrc" && echo "source $mwconfig $MARKER" >> "$muttrc" + ! grep "^source.*.muttrc" "$muttrc" | grep -qv "$mwconfig" && echo "source $accdir/$idnum-$title.muttrc $MARKER" >> "$muttrc" echo "macro index,pager i$idnum 'source $accdir/$idnum-$title.muttrc!;' \"switch to $fulladdr\" $MARKER" >> "$muttrc" + } protonfinger() { printf "Getting Protonmail bridge fingerprint...\\n" @@ -225,18 +242,23 @@ getpass() { while : ; do pass rm -f "$pass_prefix$title" >/dev/null 2>&1 formatShortcut() { toappend="$toappend macro index,pager g$1 \"=$3\" \"go to $2\" $MARKER + getpass macro index,pager M$1 \";=$3\" \"move mail to $2\" $MARKER + getpass macro index,pager C$1 \";=$3\" \"copy mail to $2\" $MARKER" >> "$accdir/$idnum-$title.muttrc" } setBox() { toappend="$toappend set $1 = \"+$2\" $MARKER" ;} -tryconnect() { mkdir -p "$maildir/$title" +getboxes() { [ -n "${force+x}" ] && mailboxes="INBOX +Drafts +Junk +Sent +Archive" && return 0 if mailboxes="$(mbsync -l "$title" | sed 's/\//./')" >/dev/null 2>&1 && [ -n "$mailboxes" ]; then [ "$accounttype" = "online" ] && sed -ibu "/IMAPStore $title-remote$/,/# End profile/d" "$mbsyncrc" ; rm -f "$mbsyncrc"bu printf "\033[32mMailboxes detected.\033[0m\\n" - echo "$mailboxes" | xargs -I {} mkdir -p "$maildir/$title/{}" return 0 else printf "\033[31m\033[31mLog-on not successful.\033[0m\\nIt seems that either you inputted the wrong password or server settings, or there are other requirements for your account out of the control of mutt-wizard.\\n" @@ -244,12 +266,17 @@ tryconnect() { mkdir -p "$maildir/$title" fi ;} finalize() { \ - boxes="$(find "$maildir/$title/" -mindepth 1 -type d | sed "s/\ /\\\ /g;s/^.*\///;/\(cur\|new\|tmp\)$/d")" - [ -z "$boxes" ] && printf "\033[31mNo local mailboxes have been detected for %s.\033[0m\\nThis means that mbsync has not been successfully run.\\nRun mbsync, and if it has an error, be sure to check your password and server settings manually if needbe.\\n" "$title" && return + + # Create the required mailbox structure. + echo "$mailboxes" | xargs -I {} mkdir -p "$maildir/$title/{}" + printf "Setting default mailboxes for your Inbox, Sent, Drafts and Trash in mutt...\\n" + sed -ibu "/$MARKER/d" "$accdir/$idnum-$title.muttrc" ; rm -f "$accdir/$idnum-$title.muttrcbu" - toappend="mailboxes $(echo "$boxes" | sed "s/^/\"=/;s/$/\"/" | paste -sd ' ' )" - for x in $boxes; do + + toappend="mailboxes $(echo "$mailboxes" | sed "s/^/\"=/;s/$/\"/" | paste -sd ' ' )" + + for x in $mailboxes; do case $x in *[Ii][Nn][Bb][Oo][Xx]*) formatShortcut i inbox "$x"; setBox spoolfile "$x" ;; *[Ss][Ee][Nn][Tt]*) setBox record "$x"; formatShortcut s sent "$x" ;; @@ -259,15 +286,19 @@ finalize() { \ *[Ss][Pp][Aa][Mm]*) formatShortcut S spam "$x" ;; esac done - printf "Setting up your keyboard shortcuts for jumping between mailboxes...\\n" + echo "$toappend" >> "$accdir/$idnum-$title.muttrc" - [ "$accounttype" = "offline" ] && printf "All done.\\n\033[33mYou should now be able to run \`\033[32mmbsync %s\033[33m\` to begin to download your mail.\033[0m\\n" "$title" + + [ -z "${online+x}" ] && printf "All done.\\n\033[33mYou should now be able to run \`\033[32mmbsync %s\033[33m\` to begin to download your mail.\033[0m\\n" "$title" + + # Create a urlview config file if non-existent. command -V urlview >/dev/null 2>&1 && [ ! -f "$HOME/.urlview" ] && echo "COMMAND \$BROWSER" > "$HOME/.urlview" + return 0 } -confirm() { printf "Do you want to %s? [yes/N]\\n\t" "$@" && read -r input && ! echo "$input" | grep -i "^yes$" >/dev/null && printf "That doesn't seem like a yes to me.\\n\\n" && return 1 - printf "Are you really, really sure you want to %s?\\n\t" "$@" && read -r input && ! echo "$input" | grep -i "^yes$" >/dev/null && printf "That doesn't seem like a yes to me.\\n\\n" && return 1 +confirm() { printf "Do you want to %s? [yes/N]\\n\t" "$@" && read -r input && ! echo "$input" | grep -qi "^yes$" && printf "That doesn't seem like a yes to me.\\n\\n" && return 1 + printf "Are you really, really sure you want to %s?\\n\t" "$@" && read -r input && ! echo "$input" | grep -qi "^yes$" && printf "That doesn't seem like a yes to me.\\n\\n" && return 1 return 0 ;} pick() { printf "Select an accounts to %s:\\n" "$1" @@ -284,21 +315,6 @@ delete() { sed -ibu "/IMAPStore $title-remote$/,/# End profile/d" "$mbsyncrc" ; sed -ibu "/account $title/,/^\(\s*$\|account\)/d" "$msmtprc"; rm -f "$msmtprc"bu } -asktype() { while : ; do - printf "Do you want to keep your mail for this account offline with mbsync? [yes/no]\\n\t" - read -r offnot - case "$offnot" in - [Yy][Ee][Ss]) accounttype="offline" && break ;; - [Nn][Oo]) accounttype="online" && break ;; - *) echo "Write out either yes or no completely. Try again or press ctrl-c to quit." ;; - esac; done ;} - -purge() { confirm "delete all account data" || exit - rm -rf "$mbsyncrc" "$accdir" "${XDG_CONFIG_HOME:-$HOME/.config}/msmtp" "$cachedir" - echo "All configs and account settings have been purged." - sed -ibu "/$MARKER/d" "$muttrc" ; rm -f "$muttrc"bu -} - syncwrapper() { mbsync "${1:--a}" & ( kill -46 "$(pidof "${STATUSBAR:-dwmblocks}")" >/dev/null 2>&1 ) 2>/dev/null wait @@ -306,6 +322,12 @@ syncwrapper() { mbsync "${1:--a}" & notmuch new } +purge() { confirm "delete all account data" || exit + rm -rf "$mbsyncrc" "$accdir" "${XDG_CONFIG_HOME:-$HOME/.config}/msmtp" "$cachedir" + echo "All configs and account settings have been purged." + sed -ibu "/$MARKER/d" "$muttrc" ; rm -f "$muttrc"bu +} + notmuchauto() { \ [ -z "$NOTMUCH_CONFIG" ] && NOTMUCH_CONFIG="$HOME/.notmuch-config" [ -f "$NOTMUCH_CONFIG" ] && return 0 @@ -327,26 +349,75 @@ gpg_path=$GPG" trap 'echo -e "\033[0m\n"; exit' INT ABRT -case "$1" in - ls) list ;; - add) asktype && askinfo && tryconnect && finalize || delete ;; - pass) pick "change the password of" && getpass ;; - delete) pick delete && confirm "delete the \`$title\` profile" && delete ;; - sync) syncwrapper "$2" ;; - purge) purge ;; +setaction() { if [ -n "${action+x}" ] && [ "$action" != "$1" ]; then + echo "Running $1 with $action..." + echo "Incompatible options given. Only one action may be specified per run." + return 1 + else + action="$1" + fi; } + +while getopts "gbpPlhdYD:y:i:I:s:S:u:a:" o; do case "${o}" in + l) setaction list || exit 1 ;; + p) setaction pass || exit 1 ;; + d) setaction delete || exit 1 ;; + D) setaction delete || exit 1 ; title="$OPTARG" ;; + y) setaction sync || exit 1 ; title="$OPTARG" ;; + Y) setaction sync || exit 1 ;; + + a) setaction add || exit 1 ; fulladdr="$OPTARG" ;; + i) setaction add || exit 1 ; imap="$OPTARG" ;; + I) setaction add || exit 1 ; iport="$OPTARG" ;; + s) setaction add || exit 1 ; smtp="$OPTARG" ;; + S) setaction add || exit 1 ; sport="$OPTARG" ;; + u) setaction add || exit 1 ; login="$OPTARG" ;; + + o) setaction add || exit 1 ; online=True ;; + b) setaction add || exit 1 ; force=True ;; + P) echo "NOTE: Protonmail users must install and configure Protonmail Bridge first for the first sync to work." + proton=True + imap="127.0.0.1" + iport=1143 + smtp="127.0.0.1" + sport=1025 + setaction add || exit 1 + ;; + + g) debug ;; + *) cat << EOF mw: mutt-wizard, auto-configure email accounts for mutt including downloadable mail with \`isync\`. -Allowed options: - add Add and autoconfigure an email address (9 max.) - ls List configured accounts - delete Pick an account to delete - purge Delete all accounts and settings - sync Syncs mail and updates notmuch database - all else Print this message +Main actions: + -a your@email.com Add an email address + -d Remove an already added address + -D nameofaccount Force remove account without confirmation + -l List email addresses configured + -y nameofaccount Sync mail for account by name + -Y Sync mail for all accounts + +Options allowed with -a: + -u Account login name if not full address. + -i IMAP server address + -I IMAP server port + -s SMTP server address + -S SMTP server port + -p Install for a Protonmail account. + -o Configure address, but keep mail online. + -b Assume typical English mailboxes without attempting log-on. NOTE: Once at least one account is added, you can run \`mbsync -a\` to begin downloading mail. EOF +;; +esac done + +case "$action" in + list) list ;; + add) askinfo && writeinfo && getboxes && finalize || delete ;; + pass) pick "change the password of" && getpass ;; + delete) pick delete && confirm "delete the \`$title\` profile" && delete ;; + sync) syncwrapper $title ;; + purge) purge ;; esac From cf6b8fd052a45986e1d64b82255405b4188620e1 Mon Sep 17 00:00:00 2001 From: ccmywish Date: Thu, 8 Oct 2020 13:58:40 +0800 Subject: [PATCH 043/225] Add qq,126,163 mail for chinese users --- share/domains.csv | 3 +++ 1 file changed, 3 insertions(+) diff --git a/share/domains.csv b/share/domains.csv index 115fd19..c57aa25 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -1,4 +1,6 @@ ADDRESS,IMAP,imap port,SMTP,smtp port +126.com,imap.126.com,993,smtp.126.com,587 +163.com,imap.163.com,993,smtp.163.com,587 420blaze.it,mail.cock.li,993,mail.cock.li,587 8chan.co,mail.cock.li,993,mail.cock.li,587 aaathats3as.com,mail.cock.li,993,mail.cock.li,587 @@ -195,6 +197,7 @@ privacyrequired.com,mail.autistici.org,993,smtp.autistici.org,465 prokonto.pl,poczta.o2.pl,993,poczta.o2.pl,465 protonmail.ch,127.0.0.1,1143,127.0.0.1,1025 protonmail.com,127.0.0.1,1143,127.0.0.1,1025 +qq.com,imap.qq.com,993,smtp.qq.com,587 rape.lol,mail.cock.li,993,mail.cock.li,587 redchan.it,mail.cock.li,993,mail.cock.li,587 resch.pw,mail.resch.pw,993,mail.resch.pw,587 From 601d496fdf0df4d2f48877c545f0eee60632a9b2 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 9 Oct 2020 09:46:50 -0400 Subject: [PATCH 044/225] 3.0 release --- README.md | 31 ++++++-- bin/mw | 232 +++++++++++++++++++++++------------------------------- mw.1 | 70 ++++++++++++---- 3 files changed, 178 insertions(+), 155 deletions(-) diff --git a/README.md b/README.md index 0da14f4..0a7629f 100644 --- a/README.md +++ b/README.md @@ -27,12 +27,31 @@ User of Arch-based distros can also install mutt-wizard from the AUR as [mutt-wi The mutt-wizard is run with the command `mw`. Once everything is setup, you'll use `neomutt` to access your mail. -- `mw add` -- add a new email account -- `mw ls` -- list existing accounts -- `mw pass` -- revise an account's password -- `mw delete` -- delete an added account -- `mw sync` -- sync all mail accounts and update notmuch database -- `mw purge` -- delete all accounts and settings +- `mw -a you@email.com` -- add a new email account +- `mw -l` -- list existing accounts +- `mw -y your@email.com` -- sync an email account +- `my -Y` -- sync all configured email accounts +- `mw -d` -- choose an account to delete +- `mw -D your@email.com` -- delete account settings without confirmation +- `pass edit mw-your@email.com` -- revise an account's password + +### Options usable when adding an account + +#### Providing arguments + +- `-u` -- Give an account username if different from the email address. If you use my [emailwiz](https://github.com/lukesmithxyz/emailwiz), give your username with this option. Not necessary for other accounts. +- `-n` -- A real name to be used by the account. Put in quotations if multiple words +- `-i` -- IMAP server address +- `-I` -- IMAP server port (otherwise assumed to be 993) +- `-s` -- SMTP server address +- `-S` -- SMTP server port (otherwise assumed to be 587) +- `-m` -- Maximum number of emails to be kept offline. No maximum is default functionality. + +#### General Settings + +- `-p` -- Add a Protonmail account +- `-f` -- Assume mailbox names and force account configuration without connecting online at all. +- `-o` -- Configure mutt for an account, but do not keep mail offline. ## Dependencies diff --git a/bin/mw b/bin/mw index e23e5a1..387747a 100755 --- a/bin/mw +++ b/bin/mw @@ -1,20 +1,5 @@ #!/bin/sh -debug() { - echo "fulladdr: $fulladdr" - echo "login: $login" - echo "title: $title" - echo "imap: $imap" - echo "iport: $iport" - echo "smtp: $smtp" - echo "sport: $sport" - echo "proton: $proton" - echo "tls: $tls" - echo "force: $force" - echo "online: $online" - echo "action: $action" -} - command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2" [ -z ${PASSWORD_STORE_DIR+x} ] && PASSWORD_STORE_DIR="$HOME/.password-store" [ -r "$PASSWORD_STORE_DIR/.gpg-id" ] && @@ -22,7 +7,6 @@ command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2" printf "\`pass\` must be installed and initialized to encrypt passwords.\\nBe sure it is installed and run \`pass init \`.\\nIf you don't have a GPG public private key pair, run \`%s --full-gen-key\` first.\\n" "$GPG" exit } -! command -v mbsync >/dev/null && printf "\`mbsync (isync package)\` must be installed to run mutt-wizard.\\n" && exit prefix="/usr/local" pass_prefix="mw-" @@ -38,7 +22,6 @@ cachedir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard" muttrc="$muttdir/muttrc" msmtprc="${XDG_CONFIG_HOME:-$HOME/.config}/msmtp/config" msmtplog="${XDG_CONFIG_HOME:-$HOME/.config}/msmtp/msmtp.log" -ssltype="IMAPS" # This is later changed to `None` later in the script if using Protonmail MARKER="# mw-autogenerated" alias mbsync='mbsync -c "$mbsyncrc"' @@ -47,63 +30,63 @@ 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 ;} -getaccounts() { accounts="$(find "$accdir" -type f | grep -o "[0-9]-.*.muttrc" | sed "s/-/: /;s/\..*//" | sort -n)" ;} +getaccounts() { accounts="$(find "$accdir" -type f | grep -o "[0-9]-.*.muttrc" | sed "s/-/: /;s/\.muttrc$//" | sort -n)" ;} + list() { getaccounts && [ -n "$accounts" ] && echo "$accounts" ;} getprofiles() { \ unset msmtp_header msmtp_profile mutt_profile mbsync_profile - printf "Creating profiles for \`%s\`..." "$title" msmtp_header="defaults auth on tls on tls_trust_file $sslcert logfile $msmtplog " -msmtp_profile="account $title +msmtp_profile="account $fulladdr host $smtp port ${sport:-587} from $fulladdr user $login -passwordeval \"pass $pass_prefix$title\" +passwordeval \"pass $pass_prefix$fulladdr\" $starttlsoff " -mbsync_profile="IMAPStore $title-remote +mbsync_profile="IMAPStore $fulladdr-remote Host $imap Port ${iport:-993} User $login -PassCmd \"pass $pass_prefix$title\" +PassCmd \"pass $pass_prefix$fulladdr\" AuthMechs LOGIN -SSLType $ssltype +SSLType ${ssltype:-IMAPS} CertificateFile $sslcert -MaildirStore $title-local +MaildirStore $fulladdr-local Subfolders Verbatim -Path ${XDG_DATA_HOME:-$HOME/.local/share}/mail/$title/ -Inbox ${XDG_DATA_HOME:-$HOME/.local/share}/mail/$title/INBOX +Path ${XDG_DATA_HOME:-$HOME/.local/share}/mail/$fulladdr/ +Inbox ${XDG_DATA_HOME:-$HOME/.local/share}/mail/$fulladdr/INBOX Flatten . -Channel $title +Channel $fulladdr Expunge Both -Master :$title-remote: -Slave :$title-local: +Master :$fulladdr-remote: +Slave :$fulladdr-local: Patterns * !\"[Gmail]/All Mail\" Create Both SyncState * -MaxMessages $maxmes +MaxMessages ${maxmes:-0} ExpireUnread no # End profile " if [ -z "${online+x}" ]; then mutt_profile="# vim: filetype=neomuttrc -# muttrc file for account $title +# muttrc file for account $fulladdr set realname = \"$realname\" set from = \"$fulladdr\" -set sendmail = \"msmtp -a $title\" +set sendmail = \"msmtp -a $fulladdr\" alias me $realname <$fulladdr> -set folder = \"$maildir/$title\" -set header_cache = $cachedir/$title/headers -set message_cachedir = $cachedir/$title/bodies +set folder = \"$maildir/$fulladdr\" +set header_cache = $cachedir/$fulladdr/headers +set message_cachedir = $cachedir/$fulladdr/bodies set mbox_type = Maildir bind index,pager gg noop @@ -111,21 +94,21 @@ bind index,pager g noop bind index,pager M noop bind index,pager C noop bind index gg first-entry -macro index o \"mbsync -V $title\" \"run mbsync to sync $title\" +macro index o \"mbsync -V $fulladdr\" \"run mbsync to sync $fulladdr\" unmailboxes * " else mutt_profile="# vim: filetype=neomuttrc -# muttrc file for account $title +# muttrc file for account $fulladdr set realname = \"$realname\" set from = \"$fulladdr\" -set sendmail = \"msmtp -a $title\" +set sendmail = \"msmtp -a $fulladdr\" alias me $realname <$fulladdr> set folder = \"imaps://$login@$imap:${iport:-993}\" set imap_user = \"$login\" -set header_cache = $cachedir/$title/headers -set message_cachedir = $cachedir/$title/bodies -set imap_pass = \"\`pass $pass_prefix$title\`\" +set header_cache = $cachedir/$fulladdr/headers +set message_cachedir = $cachedir/$fulladdr/bodies +set imap_pass = \"\`pass $pass_prefix$fulladdr\`\" set mbox_type = Maildir set ssl_starttls = yes @@ -142,7 +125,10 @@ fi printf "DONE.\\n" } -parsedomains(){ serverinfo="$(grep "^${fulladdr#*@}" "$muttshare/domains.csv" 2>/dev/null)" +parsedomains(){ \ + # Parses the domains.csv file for server information and sets + # the required variables unless overridden by the user. + serverinfo="$(grep "^${fulladdr#*@}" "$muttshare/domains.csv" 2>/dev/null)" [ -z "$serverinfo" ] && serverinfo="$(grep "$(echo "${fulladdr#*@}" | sed "s/\.[^\.]*$/\.\\\*/")" "$muttshare/domains.csv" 2>/dev/null)" @@ -156,39 +142,42 @@ EOF iport="${iport:-$iportsugg}" } +delete() { if [ -z "${fulladdr+x}" ]; then + echo "Select the account your would like to delete (by number):" + list + read -r input + match="^$input:" + else + match=" $fulladdr$" + getaccounts + fi + + fulladdr="$(echo "$accounts" | grep "$match" | cut -f2 -d' ')" + + [ -z "$fulladdr" ] && echo "Invalid account name given." && return 1 + + sed -ibu "/IMAPStore $fulladdr-remote$/,/# End profile/d" "$mbsyncrc" ; rm -rf "$mbsyncrc"bu + rm -rf "${cachedir:?}/${fulladdr:?}" "$accdir/"[1-9]"-$fulladdr.muttrc" + sed -ibu "/[0-9]-$fulladdr.muttrc/d" "$muttrc" ; rm -f "$muttrc"bu + sed -ibu "/account $fulladdr/,/^\(\s*$\|account\)/d" "$msmtprc"; rm -f "$msmtprc"bu + } + askinfo() { \ [ -z "$fulladdr" ] && echo "Give the full email address to add:" && read -r fulladdr - while ! echo "$fulladdr" | grep -qE "$emailre"; do echo "\`$fulladdr\` is not a valid email address. Please retype the address:" read -r fulladdr done - - # If we don't have either the IMAP or SMTP servers, look for them and ports. { [ -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 [ "$sport" = 465 ] && starttlsoff="tls_starttls off" - [ -z "$realname" ] && echo "Give the name you would like to be identified by on the email account:" && read -r realname - - title="$fulladdr" - #while ! echo "$title" | grep -q "$namere" || ls "$accdir"/[0-9]"-$title.muttrc" >/dev/null 2>&1; do - #printf "\033[31mTry again\033[0m. Pick a nickname that is one word only including lowercase letters and _ or - and that you have \033[1mnot\033[0m used before.\\n\tAccount name: \033[36m\t" - #read -r title - #printf "\033[0m" - #done - - [ -z "$login" ] && echo "Give the account log-on/username for this address:" && read -r login login="${login:-$fulladdr}" - - - - #case "$service" in - #gmail.com) printf "\033[31mREMEMBER: Gmail users must enable \"less secure\" (third-party) applications first for the sync to work:\\nhttps://support.google.com/accounts/answer/6010255\\n\033[0m" ;; - #protonmail.ch|protonmail.com|pm.me) printf "\033[31mREMEMBER: Protonmail users must install and configure Protonmail Bridge first for the sync to work:\\nhttps://protonmail.com/bridge/\\n\033[0m" && ssltype="None" ;; - #esac - getpass } @@ -198,7 +187,7 @@ writeinfo() { getprofiles # Create required directories. - mkdir -p "$muttdir" "$accdir" "$cachedir/$title/bodies" "${XDG_CONFIG_HOME:-$HOME/.config}/msmtp" "$maildir/$title" + mkdir -p "$muttdir" "$accdir" "$cachedir/$fulladdr/bodies" "${XDG_CONFIG_HOME:-$HOME/.config}/msmtp" "$maildir/$fulladdr" # Get accounts and find the first missing account number (max. 9). getaccounts @@ -214,7 +203,7 @@ writeinfo() { command -V apt-get >/dev/null 2>&1 && ln -s "$msmtprc" "$HOME/.msmtprc" 2>/dev/null # Create the individual mutt config file for the account. - echo "$mutt_profile" > "$accdir/$idnum-$title.muttrc" + echo "$mutt_profile" > "$accdir/$idnum-$fulladdr.muttrc" # Create the mbsync config file. mkdir -p "${mbsyncrc%/*}" @@ -227,26 +216,21 @@ writeinfo() { # and add the shortcuts to the account. [ ! -f "$muttrc" ] && echo "# vim: filetype=neomuttrc" > "$muttrc" && echo "muttrc created." ! grep -q "^source.*mutt-wizard.muttrc" "$muttrc" && echo "source $mwconfig $MARKER" >> "$muttrc" - ! grep "^source.*.muttrc" "$muttrc" | grep -qv "$mwconfig" && echo "source $accdir/$idnum-$title.muttrc $MARKER" >> "$muttrc" - echo "macro index,pager i$idnum 'source $accdir/$idnum-$title.muttrc!;' \"switch to $fulladdr\" $MARKER" >> "$muttrc" - + ! grep "^source.*.muttrc" "$muttrc" | grep -qv "$mwconfig" && echo "source $accdir/$idnum-$fulladdr.muttrc $MARKER" >> "$muttrc" + echo "macro index,pager i$idnum 'source $accdir/$idnum-$fulladdr.muttrc!;' \"switch to $fulladdr\" $MARKER" >> "$muttrc" } protonfinger() { printf "Getting Protonmail bridge fingerprint...\\n" - fingerprint="$(msmtp --serverinfo --host=127.0.0.1 --port=1025 --tls --tls-certcheck=off | grep SHA256: | sed 's/^.*: //')" - sed -ibu "s/account $title/&\ntls_trust_file\ntls_fingerprint $fingerprint/" "$msmtprc" ; rm -f "$msmtprc"bu -} + fingerprint="$(msmtp --serverinfo --host=$smtp --port=$sport --tls --tls-certcheck=off | grep SHA256: | sed 's/^.*: //')" + sed -ibu "s/account $fulladdr/&\ntls_trust_file\ntls_fingerprint $fingerprint/" "$msmtprc" ; rm -f "$msmtprc"bu ;} -getpass() { while : ; do pass rm -f "$pass_prefix$title" >/dev/null 2>&1 - pass insert "$pass_prefix$title" && break; done ;} +getpass() { while : ; do pass rm -f "$pass_prefix$fulladdr" >/dev/null 2>&1 + pass insert "$pass_prefix$fulladdr" && break; done ;} formatShortcut() { toappend="$toappend macro index,pager g$1 \"=$3\" \"go to $2\" $MARKER - getpass macro index,pager M$1 \";=$3\" \"move mail to $2\" $MARKER - getpass -macro index,pager C$1 \";=$3\" \"copy mail to $2\" $MARKER" >> "$accdir/$idnum-$title.muttrc" -} +macro index,pager C$1 \";=$3\" \"copy mail to $2\" $MARKER" >> "$accdir/$idnum-$fulladdr.muttrc" ;} setBox() { toappend="$toappend set $1 = \"+$2\" $MARKER" ;} @@ -254,73 +238,54 @@ set $1 = \"+$2\" $MARKER" ;} getboxes() { [ -n "${force+x}" ] && mailboxes="INBOX Drafts Junk +Trash Sent Archive" && return 0 - if mailboxes="$(mbsync -l "$title" | sed 's/\//./')" >/dev/null 2>&1 && [ -n "$mailboxes" ]; then - [ "$accounttype" = "online" ] && sed -ibu "/IMAPStore $title-remote$/,/# End profile/d" "$mbsyncrc" ; rm -f "$mbsyncrc"bu - printf "\033[32mMailboxes detected.\033[0m\\n" + if mailboxes="$(mbsync -l "$fulladdr" | sed 's/\//./')" >/dev/null 2>&1 && [ -n "$mailboxes" ]; then + [ "$accounttype" = "online" ] && sed -ibu "/IMAPStore $fulladdr-remote$/,/# End profile/d" "$mbsyncrc" ; rm -f "$mbsyncrc"bu return 0 else + echo "$mailboxes" printf "\033[31m\033[31mLog-on not successful.\033[0m\\nIt seems that either you inputted the wrong password or server settings, or there are other requirements for your account out of the control of mutt-wizard.\\n" return 1 fi ;} -finalize() { \ - - # Create the required mailbox structure. - echo "$mailboxes" | xargs -I {} mkdir -p "$maildir/$title/{}" - - printf "Setting default mailboxes for your Inbox, Sent, Drafts and Trash in mutt...\\n" - - sed -ibu "/$MARKER/d" "$accdir/$idnum-$title.muttrc" ; rm -f "$accdir/$idnum-$title.muttrcbu" - +finalize() { echo "$mailboxes" | xargs -I {} mkdir -p "$maildir/$fulladdr/{}/cur" "$maildir/$fulladdr/{}/tmp" "$maildir/$fulladdr/{}/new" + sed -ibu "/$MARKER/d" "$accdir/$idnum-$fulladdr.muttrc" ; rm -f "$accdir/$idnum-$fulladdr.muttrcbu" toappend="mailboxes $(echo "$mailboxes" | sed "s/^/\"=/;s/$/\"/" | paste -sd ' ' )" - for x in $mailboxes; do case $x in *[Ii][Nn][Bb][Oo][Xx]*) formatShortcut i inbox "$x"; setBox spoolfile "$x" ;; *[Ss][Ee][Nn][Tt]*) setBox record "$x"; formatShortcut s sent "$x" ;; *[Dd][Rr][Aa][Ff][Tt][Ss]*) setBox postponed "$x"; formatShortcut d drafts "$x" ;; - *[Tt][Rr][Aa][Ss][Hh]*|*[Jj][Uu][Nn][Kk]*) formatShortcut t trash "$x"; setBox trash "$x" ;; + *[Tt][Rr][Aa][Ss][Hh]*) formatShortcut t trash "$x"; setBox trash "$x" ;; + *[Jj][Uu][Nn][Kk]*) formatShortcut j junk "$x" ;; *[Aa][Rr][Cc][Hh][Ii][Vv][Ee]*) formatShortcut a archive "$x" ;; *[Ss][Pp][Aa][Mm]*) formatShortcut S spam "$x" ;; esac done - - echo "$toappend" >> "$accdir/$idnum-$title.muttrc" - - [ -z "${online+x}" ] && printf "All done.\\n\033[33mYou should now be able to run \`\033[32mmbsync %s\033[33m\` to begin to download your mail.\033[0m\\n" "$title" - - # Create a urlview config file if non-existent. + echo "$toappend" >> "$accdir/$idnum-$fulladdr.muttrc" + [ -z "${online+x}" ] && printf "\033[33mYou should now be able to run \`\033[32mw -y %s\033[33m\` to begin to download your mail.\033[0m\\n" "$fulladdr" command -V urlview >/dev/null 2>&1 && [ ! -f "$HOME/.urlview" ] && echo "COMMAND \$BROWSER" > "$HOME/.urlview" - - return 0 -} + return 0 ;} confirm() { printf "Do you want to %s? [yes/N]\\n\t" "$@" && read -r input && ! echo "$input" | grep -qi "^yes$" && printf "That doesn't seem like a yes to me.\\n\\n" && return 1 printf "Are you really, really sure you want to %s?\\n\t" "$@" && read -r input && ! echo "$input" | grep -qi "^yes$" && printf "That doesn't seem like a yes to me.\\n\\n" && return 1 return 0 ;} -pick() { printf "Select an accounts to %s:\\n" "$1" +pick() { [ -n "${fulladdr+x}" ] && return 0 + echo "Select the account your would like to $1 (by number):" list read -r input - [ -z "$input" ] && return 1 - title="$(echo "$accounts" | grep "$input" | awk '{print $2}')" - [ -z "$title" ] && printf "Invalid response." && return 1 + fulladdr="$(echo "$accounts" | grep "^$input:" | cut -f2 -d' ')" + [ -z "$fulladdr" ] && echo "Invalid response." && return 1 return 0 ;} -delete() { sed -ibu "/IMAPStore $title-remote$/,/# End profile/d" "$mbsyncrc" ; rm -rf "$mbsyncrc"bu - rm -rf "${cachedir:?}/${title:?}" "$accdir/"[1-9]"-$title.muttrc" - sed -ibu "/[0-9]-$title.muttrc/d" "$muttrc" ; rm -f "$muttrc"bu - sed -ibu "/account $title/,/^\(\s*$\|account\)/d" "$msmtprc"; rm -f "$msmtprc"bu - } - syncwrapper() { mbsync "${1:--a}" & ( kill -46 "$(pidof "${STATUSBAR:-dwmblocks}")" >/dev/null 2>&1 ) 2>/dev/null wait ( kill -46 "$(pidof "${STATUSBAR:-dwmblocks}")" >/dev/null 2>&1 ) 2>/dev/null - notmuch new -} + notmuch new ;} purge() { confirm "delete all account data" || exit rm -rf "$mbsyncrc" "$accdir" "${XDG_CONFIG_HOME:-$HOME/.config}/msmtp" "$cachedir" @@ -357,48 +322,47 @@ setaction() { if [ -n "${action+x}" ] && [ "$action" != "$1" ]; then action="$1" fi; } -while getopts "gbpPlhdYD:y:i:I:s:S:u:a:" o; do case "${o}" in +while getopts "fplhdYD:y:i:I:s:S:u:a:n:" o; do case "${o}" in l) setaction list || exit 1 ;; - p) setaction pass || exit 1 ;; d) setaction delete || exit 1 ;; - D) setaction delete || exit 1 ; title="$OPTARG" ;; - y) setaction sync || exit 1 ; title="$OPTARG" ;; + D) setaction delete || exit 1 ; fulladdr="$OPTARG" ;; + y) setaction sync || exit 1 ; fulladdr="$OPTARG" ;; Y) setaction sync || exit 1 ;; - a) setaction add || exit 1 ; fulladdr="$OPTARG" ;; i) setaction add || exit 1 ; imap="$OPTARG" ;; I) setaction add || exit 1 ; iport="$OPTARG" ;; s) setaction add || exit 1 ; smtp="$OPTARG" ;; S) setaction add || exit 1 ; sport="$OPTARG" ;; u) setaction add || exit 1 ; login="$OPTARG" ;; - + n) setaction add || exit 1 ; realname="$OPTARG" ;; + m) setaction add || exit 1 ; maxmes="$OPTARG" ;; o) setaction add || exit 1 ; online=True ;; - b) setaction add || exit 1 ; force=True ;; - P) echo "NOTE: Protonmail users must install and configure Protonmail Bridge first for the first sync to work." + f) setaction add || exit 1 ; force=True ;; + p) echo "NOTE: Protonmail users must install and configure Protonmail Bridge first for the first sync to work." proton=True imap="127.0.0.1" - iport=1143 + iport="1143" smtp="127.0.0.1" - sport=1025 + sport="1025" + ssltype="None" + protonfinger setaction add || exit 1 ;; - - g) debug ;; - *) cat << EOF mw: mutt-wizard, auto-configure email accounts for mutt including downloadable mail with \`isync\`. Main actions: -a your@email.com Add an email address - -d Remove an already added address - -D nameofaccount Force remove account without confirmation -l List email addresses configured - -y nameofaccount Sync mail for account by name + -d Remove an already added address + -D your@email.com Force remove account without confirmation + -y your@email.com Sync mail for account by name -Y Sync mail for all accounts Options allowed with -a: -u Account login name if not full address. + -n "Real name" to be on the email account. -i IMAP server address -I IMAP server port -s SMTP server address @@ -409,15 +373,19 @@ Options allowed with -a: NOTE: Once at least one account is added, you can run \`mbsync -a\` to begin downloading mail. + +To chane an account's password, run \`pass edit ${pass_prefix}your@email.com\`. EOF +exit 1 ;; esac done +! command -v mbsync >/dev/null && [ -z "${force+x}" ] && printf "\`mbsync (isync package)\` must be installed to run mutt-wizard.\\n" && exit + case "$action" in list) list ;; add) askinfo && writeinfo && getboxes && finalize || delete ;; - pass) pick "change the password of" && getpass ;; - delete) pick delete && confirm "delete the \`$title\` profile" && delete ;; - sync) syncwrapper $title ;; + delete) delete $fulladdr ;; + sync) syncwrapper $fulladdr ;; purge) purge ;; esac diff --git a/mw.1 b/mw.1 index 55ad43c..eb344b3 100644 --- a/mw.1 +++ b/mw.1 @@ -3,7 +3,9 @@ mw \- mutt-wizard \- autoconfigure email accounts for neomutt and isync .SH SYNOPSIS .B mw - +[ +.I OPTIONS +] .SH DESCRIPTION .B mw takes a user email account and sets up a terminal-based email interface for it with @@ -16,22 +18,58 @@ for sending mail, and also passwords automatically encrypted and stored with .B pass. .SH COMMANDS .TP -.B add -configure an email account +.B -a your@email.com +add an email address .TP -.B ls +.B -l list all email accounts configured by mutt-wizard .TP -.B delete -delete the configuration files for an already configured email account +.B -d +pick an already configured account and remove its configuration .TP -.B purge -totally purge all local mutt-wizard accounts +.B -D your@email.com +remove a configured account without confirmation .TP -.B sync -sync mail accounts then update notmuch database -.B mailsync -as often as you wish +.B -y your@email.com +download and upload mail for an email account +.TP +.B -Y +sync all email accounts +.SH OPTIONS FOR ADDING ACCOUNTS +These can be specified on the command line, otherwise, you will be prompted for what is necessary. mutt-wizard knows the IMAP/SMTP server information for most email providers, so specifying them is usually redundant. +.TP +.B -u billy +Account logon/username if required and different from email address. +.TP +.B -n Billy +Real name which will appear in emails. Should be put in quotes if multiple words. +.TP +.B -m number +Set a maximum number of messages to be stored offline. +.TP +.B -i +IMAP server address +.TP +.B -I +IMAP server port (assumed to be 993 if not specified) +.TP +.B -s +SMTP server address +.TP +.B -S +SMTP server port (assumed to be 587 if not specified) +.SH OTHER OPTIONS +.TP +.B -f +Force account creation and guess mailboxes without attempting to connect to server. Otherwise if connection cannot be made, the configured account settings will not be persistent. +.TP +.B -o +Create settings for an account to be used online only without mail syncing abilities. Without +.B -f +connection will still be attempted in setup to discover mailboxes. +.TP +.B -p +Add a Protonmail account. Protonmail Bridge must be installed and set up. .SH DETAILS .TP .B Mail location @@ -52,11 +90,9 @@ and can be edited by the user if needbe. Note that the mutt-wizard will also sou file. .TP .B Mail deletion -Neither -.B delete -or -.B purge -will delete downloaded mail for safety (and time)'s sake. If you want to delete downloaded mail, do so manually by removing it from the directory above. +mutt-wizard's delete action will delete configuration files and +.I not +downloaded mail for safety (and time)'s sake. If you want to delete downloaded mail, do so manually by removing it from the directory above. .TP .B Default settings The mutt-wizard has many default settings that focus on making it aesthetically pleasing and supplying more vim-like bindings. These can be found in From 645152d9341d18e5f337b850b202b0cf61774e9d Mon Sep 17 00:00:00 2001 From: Adam Mertzenich <62816361+Mertzenich@users.noreply.github.com> Date: Sat, 10 Oct 2020 22:23:17 -0500 Subject: [PATCH 045/225] Update domains.csv --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index c57aa25..5119d76 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -146,6 +146,7 @@ logorroici.org,mail.autistici.org,993,smtp.autistici.org,465 loves.dicksinhisan.us,mail.cock.li,993,mail.cock.li,587 loves.dicksinmyan.us,mail.cock.li,993,mail.cock.li,587 lukesmith.xyz,mail.lukesmith.xyz,993,mail.lukesmith.xyz,587 +luther.edu,imap.gmail.com,993,smtp.gmail.com,587 mail.com,imap.mail.com,993,smtp.mail.com,587 mail.de,imap.mail.de,993,smtp.mail.de,465 mail.mcgill.ca,outlook.office365.com,993,smtp.office365.com,587 From c08cfd53654bb3046502955c93399861b487c760 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sun, 11 Oct 2020 19:29:34 -0400 Subject: [PATCH 046/225] more --- bin/mw | 50 ++++++++-------------------------------- share/mutt-wizard.muttrc | 2 +- 2 files changed, 11 insertions(+), 41 deletions(-) diff --git a/bin/mw b/bin/mw index 387747a..6f4448f 100755 --- a/bin/mw +++ b/bin/mw @@ -94,7 +94,7 @@ bind index,pager g noop bind index,pager M noop bind index,pager C noop bind index gg first-entry -macro index o \"mbsync -V $fulladdr\" \"run mbsync to sync $fulladdr\" +macro index o \"mw -y $fulladdr\" \"run mbsync to sync $fulladdr\" unmailboxes * " else @@ -182,42 +182,31 @@ askinfo() { \ } -writeinfo() { - # Insert account information into variables. - getprofiles - - # Create required directories. - mkdir -p "$muttdir" "$accdir" "$cachedir/$fulladdr/bodies" "${XDG_CONFIG_HOME:-$HOME/.config}/msmtp" "$maildir/$fulladdr" +writeinfo() { mkdir -p "$muttdir" "$accdir" "$cachedir/$fulladdr/bodies" "${XDG_CONFIG_HOME:-$HOME/.config}/msmtp" "$maildir/$fulladdr" # Get accounts and find the first missing account number (max. 9). getaccounts for x in $(seq 1 9); do echo "$accounts" | grep -q "$x" || { export idnum="$x"; break ;}; done - # Create msmtprc file if not present. + # Configure msmtprc for sending mail. [ ! -f "$msmtprc" ] && echo "$msmtp_header" > "$msmtprc" - - # Add account msmtp settings. echo "$msmtp_profile" >> "$msmtprc" - # On Ubuntu/Debian, a link is needed since they use an older version. command -V apt-get >/dev/null 2>&1 && ln -s "$msmtprc" "$HOME/.msmtprc" 2>/dev/null - # Create the individual mutt config file for the account. - echo "$mutt_profile" > "$accdir/$idnum-$fulladdr.muttrc" - # Create the mbsync config file. mkdir -p "${mbsyncrc%/*}" echo "$mbsync_profile" >> "$mbsyncrc" - # Create a notmuch config file if not present already. - notmuchauto - - # Create a basic muttrc is not present and source the mutt-wizard files - # and add the shortcuts to the account. - [ ! -f "$muttrc" ] && echo "# vim: filetype=neomuttrc" > "$muttrc" && echo "muttrc created." + # Create a muttrc for viewing mail. + echo "$mutt_profile" > "$accdir/$idnum-$fulladdr.muttrc" + [ ! -f "$muttrc" ] && echo "# vim: filetype=neomuttrc" > "$muttrc" ! grep -q "^source.*mutt-wizard.muttrc" "$muttrc" && echo "source $mwconfig $MARKER" >> "$muttrc" ! grep "^source.*.muttrc" "$muttrc" | grep -qv "$mwconfig" && echo "source $accdir/$idnum-$fulladdr.muttrc $MARKER" >> "$muttrc" echo "macro index,pager i$idnum 'source $accdir/$idnum-$fulladdr.muttrc!;' \"switch to $fulladdr\" $MARKER" >> "$muttrc" + + # Create a notmuch config file if not present already. + notmuchauto } protonfinger() { printf "Getting Protonmail bridge fingerprint...\\n" @@ -269,30 +258,12 @@ finalize() { echo "$mailboxes" | xargs -I {} mkdir -p "$maildir/$fulladdr/{}/cur command -V urlview >/dev/null 2>&1 && [ ! -f "$HOME/.urlview" ] && echo "COMMAND \$BROWSER" > "$HOME/.urlview" return 0 ;} -confirm() { printf "Do you want to %s? [yes/N]\\n\t" "$@" && read -r input && ! echo "$input" | grep -qi "^yes$" && printf "That doesn't seem like a yes to me.\\n\\n" && return 1 - printf "Are you really, really sure you want to %s?\\n\t" "$@" && read -r input && ! echo "$input" | grep -qi "^yes$" && printf "That doesn't seem like a yes to me.\\n\\n" && return 1 - return 0 ;} - -pick() { [ -n "${fulladdr+x}" ] && return 0 - echo "Select the account your would like to $1 (by number):" - list - read -r input - fulladdr="$(echo "$accounts" | grep "^$input:" | cut -f2 -d' ')" - [ -z "$fulladdr" ] && echo "Invalid response." && return 1 - return 0 ;} - syncwrapper() { mbsync "${1:--a}" & ( kill -46 "$(pidof "${STATUSBAR:-dwmblocks}")" >/dev/null 2>&1 ) 2>/dev/null wait ( kill -46 "$(pidof "${STATUSBAR:-dwmblocks}")" >/dev/null 2>&1 ) 2>/dev/null notmuch new ;} -purge() { confirm "delete all account data" || exit - rm -rf "$mbsyncrc" "$accdir" "${XDG_CONFIG_HOME:-$HOME/.config}/msmtp" "$cachedir" - echo "All configs and account settings have been purged." - sed -ibu "/$MARKER/d" "$muttrc" ; rm -f "$muttrc"bu -} - notmuchauto() { \ [ -z "$NOTMUCH_CONFIG" ] && NOTMUCH_CONFIG="$HOME/.notmuch-config" [ -f "$NOTMUCH_CONFIG" ] && return 0 @@ -384,8 +355,7 @@ esac done case "$action" in list) list ;; - add) askinfo && writeinfo && getboxes && finalize || delete ;; + add) askinfo && getprofiles && writeinfo && getboxes && finalize || delete ;; delete) delete $fulladdr ;; sync) syncwrapper $fulladdr ;; - purge) purge ;; esac diff --git a/share/mutt-wizard.muttrc b/share/mutt-wizard.muttrc index 57df579..de169db 100644 --- a/share/mutt-wizard.muttrc +++ b/share/mutt-wizard.muttrc @@ -80,7 +80,7 @@ set sidebar_width = 20 set sidebar_short_path = yes set sidebar_next_new_wrap = yes set mail_check_stats -set sidebar_format = '%B%?F? [%F]?%* %?N?%N/? %?S?%S?' +set sidebar_format = '%D%?F? [%F]?%* %?N?%N/? %?S?%S?' bind index,pager \Ck sidebar-prev bind index,pager \Cj sidebar-next bind index,pager \Co sidebar-open From 9fa021377427122c57e6a40813f7eb3fc4df18d3 Mon Sep 17 00:00:00 2001 From: zneix <44851575+zneix@users.noreply.github.com> Date: Mon, 12 Oct 2020 09:13:55 +0200 Subject: [PATCH 047/225] Fixed a typo in successful logon message It was a bit confusing when it said "use `w -y user@example.com` to sync your mail" --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mw b/bin/mw index 387747a..71ac332 100755 --- a/bin/mw +++ b/bin/mw @@ -265,7 +265,7 @@ finalize() { echo "$mailboxes" | xargs -I {} mkdir -p "$maildir/$fulladdr/{}/cur esac done echo "$toappend" >> "$accdir/$idnum-$fulladdr.muttrc" - [ -z "${online+x}" ] && printf "\033[33mYou should now be able to run \`\033[32mw -y %s\033[33m\` to begin to download your mail.\033[0m\\n" "$fulladdr" + [ -z "${online+x}" ] && printf "\033[33mYou should now be able to run \`\033[32mmw -y %s\033[33m\` to begin to download your mail.\033[0m\\n" "$fulladdr" command -V urlview >/dev/null 2>&1 && [ ! -f "$HOME/.urlview" ] && echo "COMMAND \$BROWSER" > "$HOME/.urlview" return 0 ;} From 317c36ca87bfff66316cce792d6a306ff1d1e05b Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Mon, 12 Oct 2020 09:05:46 -0400 Subject: [PATCH 048/225] more more --- bin/mw | 66 ++++++++++++++++++++++++++-------------------------------- 1 file changed, 30 insertions(+), 36 deletions(-) diff --git a/bin/mw b/bin/mw index cb65be3..4a9970d 100755 --- a/bin/mw +++ b/bin/mw @@ -125,22 +125,18 @@ fi printf "DONE.\\n" } -parsedomains(){ \ - # Parses the domains.csv file for server information and sets - # the required variables unless overridden by the user. - 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)" + [ -z "$serverinfo" ] && serverinfo="$(grep "$(echo "${fulladdr#*@}" | sed "s/\.[^\.]*$/\.\\\*/")" "$muttshare/domains.csv" 2>/dev/null)" - IFS=, read -r service imapsugg iportsugg smtpsugg sportsugg < "$msmtprc" @@ -205,8 +200,7 @@ writeinfo() { mkdir -p "$muttdir" "$accdir" "$cachedir/$fulladdr/bodies" "${XDG_ ! grep "^source.*.muttrc" "$muttrc" | grep -qv "$mwconfig" && echo "source $accdir/$idnum-$fulladdr.muttrc $MARKER" >> "$muttrc" echo "macro index,pager i$idnum 'source $accdir/$idnum-$fulladdr.muttrc!;' \"switch to $fulladdr\" $MARKER" >> "$muttrc" - # Create a notmuch config file if not present already. - notmuchauto + notmuchauto # Create a notmuch config file if not present already. } protonfinger() { printf "Getting Protonmail bridge fingerprint...\\n" @@ -283,9 +277,7 @@ synchronize_flags=true gpg_path=$GPG" echo "$nmbasic" > "$NOTMUCH_CONFIG" ;} -trap 'echo -e "\033[0m\n"; exit' INT ABRT - -setaction() { if [ -n "${action+x}" ] && [ "$action" != "$1" ]; then +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." return 1 @@ -293,22 +285,24 @@ setaction() { if [ -n "${action+x}" ] && [ "$action" != "$1" ]; then action="$1" fi; } +trap 'echo -e "\033[0m\n"; exit' INT ABRT + while getopts "fplhdYD:y:i:I:s:S:u:a:n:" o; do case "${o}" in - l) setaction list || exit 1 ;; - d) setaction delete || exit 1 ;; - D) setaction delete || exit 1 ; fulladdr="$OPTARG" ;; - y) setaction sync || exit 1 ; fulladdr="$OPTARG" ;; - Y) setaction sync || exit 1 ;; - a) setaction add || exit 1 ; fulladdr="$OPTARG" ;; - i) setaction add || exit 1 ; imap="$OPTARG" ;; - I) setaction add || exit 1 ; iport="$OPTARG" ;; - s) setaction add || exit 1 ; smtp="$OPTARG" ;; - S) setaction add || exit 1 ; sport="$OPTARG" ;; - u) setaction add || exit 1 ; login="$OPTARG" ;; - n) setaction add || exit 1 ; realname="$OPTARG" ;; - m) setaction add || exit 1 ; maxmes="$OPTARG" ;; - o) setaction add || exit 1 ; online=True ;; - f) setaction add || exit 1 ; force=True ;; + l) setact list || exit 1 ;; + d) setact delete || exit 1 ;; + D) setact delete || exit 1 ; fulladdr="$OPTARG" ;; + y) setact sync || exit 1 ; fulladdr="$OPTARG" ;; + Y) setact sync || exit 1 ;; + a) setact add || exit 1 ; fulladdr="$OPTARG" ;; + i) setact add || exit 1 ; imap="$OPTARG" ;; + I) setact add || exit 1 ; iport="$OPTARG" ;; + s) setact add || exit 1 ; smtp="$OPTARG" ;; + S) setact add || exit 1 ; sport="$OPTARG" ;; + u) setact add || exit 1 ; login="$OPTARG" ;; + n) setact add || exit 1 ; realname="$OPTARG" ;; + m) setact add || exit 1 ; maxmes="$OPTARG" ;; + o) setact add || exit 1 ; online=True ;; + f) setact add || exit 1 ; force=True ;; p) echo "NOTE: Protonmail users must install and configure Protonmail Bridge first for the first sync to work." proton=True imap="127.0.0.1" @@ -317,7 +311,7 @@ while getopts "fplhdYD:y:i:I:s:S:u:a:n:" o; do case "${o}" in sport="1025" ssltype="None" protonfinger - setaction add || exit 1 + setact add || exit 1 ;; *) cat << EOF mw: mutt-wizard, auto-configure email accounts for mutt From 4c268e53c7dd7b023222cf18d042268d70b6c028 Mon Sep 17 00:00:00 2001 From: Gergely Peidl Date: Mon, 12 Oct 2020 18:58:04 +0200 Subject: [PATCH 049/225] Fix typo. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0a7629f..25c0e7e 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ The mutt-wizard is run with the command `mw`. Once everything is setup, you'll u - `mw -a you@email.com` -- add a new email account - `mw -l` -- list existing accounts - `mw -y your@email.com` -- sync an email account -- `my -Y` -- sync all configured email accounts +- `mw -Y` -- sync all configured email accounts - `mw -d` -- choose an account to delete - `mw -D your@email.com` -- delete account settings without confirmation - `pass edit mw-your@email.com` -- revise an account's password From ca6cbd54b82ceb0d7b4c0987dff2c2b3b30b15fe Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Mon, 12 Oct 2020 18:50:10 -0400 Subject: [PATCH 050/225] passwords can be given by commandline --- README.md | 1 + bin/mw | 14 +++++++++++--- mw.1 | 3 +++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0a7629f..10bdc1f 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ The mutt-wizard is run with the command `mw`. Once everything is setup, you'll u - `-s` -- SMTP server address - `-S` -- SMTP server port (otherwise assumed to be 587) - `-m` -- Maximum number of emails to be kept offline. No maximum is default functionality. +- `-x` -- Account password. You will be prompted for it otherwise. #### General Settings diff --git a/bin/mw b/bin/mw index 4a9970d..eeebe53 100755 --- a/bin/mw +++ b/bin/mw @@ -122,7 +122,6 @@ bind index gg first-entry unmailboxes * " fi - printf "DONE.\\n" } parsedomains(){ serverinfo="$(grep "^${fulladdr#*@}" "$muttshare/domains.csv" 2>/dev/null)" @@ -156,6 +155,7 @@ delete() { if [ -z "${fulladdr+x}" ]; then rm -rf "${cachedir:?}/${fulladdr:?}" "$accdir/"[1-9]"-$fulladdr.muttrc" sed -ibu "/[0-9]-$fulladdr.muttrc/d" "$muttrc" ; rm -f "$muttrc"bu sed -ibu "/account $fulladdr/,/^\(\s*$\|account\)/d" "$msmtprc"; rm -f "$msmtprc"bu + pass rm -f "$pass_prefix$fulladdr" >/dev/null 2>&1 } askinfo() { \ @@ -174,9 +174,16 @@ askinfo() { \ [ -z "$realname" ] && echo "Give the name you would like to be identified by on the email account:" && read -r realname login="${login:-$fulladdr}" - getpass + if [ -n "${password+x}" ]; then + createpass + else + getpass + fi } +createpass() { echo "$password" > "$PASSWORD_STORE_DIR/$pass_prefix$fulladdr" + "$GPG" -qer "$(cat "$PASSWORD_STORE_DIR/.gpg-id")" "$PASSWORD_STORE_DIR/$pass_prefix$fulladdr" + rm -f "$PASSWORD_STORE_DIR/$pass_prefix$fulladdr" ;} writeinfo() { mkdir -p "$muttdir" "$accdir" "$cachedir/$fulladdr/bodies" "${XDG_CONFIG_HOME:-$HOME/.config}/msmtp" "$maildir/$fulladdr" @@ -287,7 +294,7 @@ setact() { if [ -n "${action+x}" ] && [ "$action" != "$1" ]; then trap 'echo -e "\033[0m\n"; exit' INT ABRT -while getopts "fplhdYD:y:i:I:s:S:u:a:n:" o; do case "${o}" in +while getopts "fplhdYD:y:i:I:s:S:u:a:n:x:" o; do case "${o}" in l) setact list || exit 1 ;; d) setact delete || exit 1 ;; D) setact delete || exit 1 ; fulladdr="$OPTARG" ;; @@ -303,6 +310,7 @@ while getopts "fplhdYD:y:i:I:s:S:u:a:n:" o; do case "${o}" in m) setact add || exit 1 ; maxmes="$OPTARG" ;; o) setact add || exit 1 ; online=True ;; f) setact add || exit 1 ; force=True ;; + x) setact add || exit 1 ; password="$OPTARG" ;; p) echo "NOTE: Protonmail users must install and configure Protonmail Bridge first for the first sync to work." proton=True imap="127.0.0.1" diff --git a/mw.1 b/mw.1 index eb344b3..3ed4d95 100644 --- a/mw.1 +++ b/mw.1 @@ -58,6 +58,9 @@ SMTP server address .TP .B -S SMTP server port (assumed to be 587 if not specified) +.TP +.B -x +Account password. You will be prompted for the password interactively if this option is not given. .SH OTHER OPTIONS .TP .B -f From 6f02c6b995795ac788ced8fad5e83bff17444481 Mon Sep 17 00:00:00 2001 From: Marc <40807627+marcwallach@users.noreply.github.com> Date: Tue, 13 Oct 2020 17:32:12 -0300 Subject: [PATCH 051/225] Fix typo --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mw b/bin/mw index eeebe53..cf5011a 100755 --- a/bin/mw +++ b/bin/mw @@ -347,7 +347,7 @@ Options allowed with -a: NOTE: Once at least one account is added, you can run \`mbsync -a\` to begin downloading mail. -To chane an account's password, run \`pass edit ${pass_prefix}your@email.com\`. +To change an account's password, run \`pass edit ${pass_prefix}your@email.com\`. EOF exit 1 ;; From befa419f64c643dc20e173cd1634e92bd2ebe1bd Mon Sep 17 00:00:00 2001 From: Yiqun Ding Date: Thu, 15 Oct 2020 14:22:19 +0800 Subject: [PATCH 052/225] add mail server setting for Zhejiang University --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index 5119d76..45edcca 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -278,5 +278,6 @@ yahoo.*,imap.mail.yahoo.com,993,smtp.mail.yahoo.com,587 yandex.*,imap.yandex.com,993,smtp.yandex.com,587 ymail.com,imap.mail.yahoo.com,993,smtp.mail.yahoo.com,465 zaclys.net,mail.zaclys.net,993,mail.zaclys.net,465 +zju.edu.cn,imap.zju.edu.cn,993,smtp.zju.edu.cn,994 zoho.com,imap.zoho.com,993,smtp.zoho.com,465 zohomail.eu,imap.zoho.eu,993,smtp.zoho.eu,465 From 27dc2f9be66388530007a71148a5f70571077d72 Mon Sep 17 00:00:00 2001 From: Julian Marcos Date: Sun, 18 Oct 2020 19:22:32 +0200 Subject: [PATCH 053/225] Added e.email service --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index 45edcca..d982ee8 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -281,3 +281,4 @@ zaclys.net,mail.zaclys.net,993,mail.zaclys.net,465 zju.edu.cn,imap.zju.edu.cn,993,smtp.zju.edu.cn,994 zoho.com,imap.zoho.com,993,smtp.zoho.com,465 zohomail.eu,imap.zoho.eu,993,smtp.zoho.eu,465 +e.email,mail.ecloud.global,993.00,mail.ecloud.global,587.00 From a978f36ec2a4309ed545009552797ef52e14b2d6 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Tue, 20 Oct 2020 19:05:06 -0400 Subject: [PATCH 054/225] protonmail fingerprint fix --- bin/mw | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/bin/mw b/bin/mw index cf5011a..59ef132 100755 --- a/bin/mw +++ b/bin/mw @@ -48,7 +48,7 @@ port ${sport:-587} from $fulladdr user $login passwordeval \"pass $pass_prefix$fulladdr\" -$starttlsoff +$tlsline " mbsync_profile="IMAPStore $fulladdr-remote Host $imap @@ -170,7 +170,7 @@ askinfo() { \ read -r imap [ -z "$smtp" ] && echo "Give your email server's SMTP address (excluding the port number):" && read -r smtp - [ "$sport" = 465 ] && starttlsoff="tls_starttls off" + [ "$sport" = 465 ] && tlsline="tls_starttls off" [ -z "$realname" ] && echo "Give the name you would like to be identified by on the email account:" && read -r realname login="${login:-$fulladdr}" @@ -210,10 +210,6 @@ writeinfo() { mkdir -p "$muttdir" "$accdir" "$cachedir/$fulladdr/bodies" "${XDG_ notmuchauto # Create a notmuch config file if not present already. } -protonfinger() { printf "Getting Protonmail bridge fingerprint...\\n" - fingerprint="$(msmtp --serverinfo --host=$smtp --port=$sport --tls --tls-certcheck=off | grep SHA256: | sed 's/^.*: //')" - sed -ibu "s/account $fulladdr/&\ntls_trust_file\ntls_fingerprint $fingerprint/" "$msmtprc" ; rm -f "$msmtprc"bu ;} - getpass() { while : ; do pass rm -f "$pass_prefix$fulladdr" >/dev/null 2>&1 pass insert "$pass_prefix$fulladdr" && break; done ;} @@ -318,7 +314,7 @@ while getopts "fplhdYD:y:i:I:s:S:u:a:n:x:" o; do case "${o}" in smtp="127.0.0.1" sport="1025" ssltype="None" - protonfinger + tlsline="tls_fingerprint $(msmtp --serverinfo --host=$smtp --port=$sport --tls --tls-certcheck=off | awk '/SHA256:/ {print $2}')" setact add || exit 1 ;; *) cat << EOF From 96c2492e6de2b7052f049e7645d182b883a107f3 Mon Sep 17 00:00:00 2001 From: inktrap Date: Tue, 27 Oct 2020 23:49:46 +0100 Subject: [PATCH 055/225] extend list to also work for symlinked accounts --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mw b/bin/mw index cf5011a..3e83ab2 100755 --- a/bin/mw +++ b/bin/mw @@ -30,7 +30,7 @@ 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 ;} -getaccounts() { accounts="$(find "$accdir" -type f | grep -o "[0-9]-.*.muttrc" | sed "s/-/: /;s/\.muttrc$//" | sort -n)" ;} +getaccounts() { accounts="$(find "$accdir" -type f -or -type l | grep -o "[0-9]-.*.muttrc" | sed "s/-/: /;s/\.muttrc$//" | sort -n)" ;} list() { getaccounts && [ -n "$accounts" ] && echo "$accounts" ;} From 16a5a450a4e9d65bbf6823a95ac37de9d2ed2aec Mon Sep 17 00:00:00 2001 From: inktrap Date: Wed, 28 Oct 2020 01:04:14 +0100 Subject: [PATCH 056/225] use -L --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mw b/bin/mw index 3e83ab2..b00f597 100755 --- a/bin/mw +++ b/bin/mw @@ -30,7 +30,7 @@ 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 ;} -getaccounts() { accounts="$(find "$accdir" -type f -or -type l | grep -o "[0-9]-.*.muttrc" | sed "s/-/: /;s/\.muttrc$//" | sort -n)" ;} +getaccounts() { accounts="$(find -L "$accdir" -type f | grep -o "[0-9]-.*.muttrc" | sed "s/-/: /;s/\.muttrc$//" | sort -n)" ;} list() { getaccounts && [ -n "$accounts" ] && echo "$accounts" ;} From e7180e1b570532c18613106c5786c1172d22831b Mon Sep 17 00:00:00 2001 From: Yiqun Ding Date: Wed, 28 Oct 2020 11:25:51 +0800 Subject: [PATCH 057/225] fix macro for sync all accounts the macro for sync all accounts uses 'mbsync -a' command, which failed to run for users who have moved their ~/.mbsyncrc somewhere else. we should use mw -Y instead, which can detect the MBSYNCRC env --- 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 de169db..ac4883e 100644 --- a/share/mutt-wizard.muttrc +++ b/share/mutt-wizard.muttrc @@ -70,7 +70,7 @@ bind editor complete-query 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 "mbsync -a" "run mbsync to sync all mail" +macro index O "mw -Y" "run mw -Y 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 12664a3f596b347b98ad33e5ff911f8396d5dedc Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Wed, 28 Oct 2020 10:24:14 -0400 Subject: [PATCH 058/225] error code on failure --- bin/mw | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/mw b/bin/mw index 59ef132..e02d3ab 100755 --- a/bin/mw +++ b/bin/mw @@ -330,12 +330,13 @@ Main actions: -Y Sync mail for all accounts Options allowed with -a: - -u Account login name if not full address. - -n "Real name" to be on the email account. + -u Account login name if not full address + -n "Real name" to be on the email account -i IMAP server address -I IMAP server port -s SMTP server address -S SMTP server port + -x Password for account (recommended to be in double quotes) -p Install for a Protonmail account. -o Configure address, but keep mail online. -b Assume typical English mailboxes without attempting log-on. @@ -353,7 +354,7 @@ esac done case "$action" in list) list ;; - add) askinfo && getprofiles && writeinfo && getboxes && finalize || delete ;; + add) askinfo && getprofiles && writeinfo && getboxes && finalize || { delete ; exit 1 ;} ;; delete) delete $fulladdr ;; sync) syncwrapper $fulladdr ;; esac From ab11cd83229325b8b86d4ed46d5b7b1b4795b460 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Wed, 28 Oct 2020 10:26:15 -0400 Subject: [PATCH 059/225] suppress autoview messages --- 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 de169db..a7aa26a 100644 --- a/share/mutt-wizard.muttrc +++ b/share/mutt-wizard.muttrc @@ -22,8 +22,9 @@ set forward_quote # include message in forwards set reverse_name # reply as whomever it was to set include # include message in replies set mail_check=60 # to avoid lags using IMAP with some email providers (yahoo for example) -auto_view text/html # automatically show html (mailcap uses w3m) +auto_view text/html # automatically show html (mailcap uses lynx) auto_view application/pgp-encrypted +set display_filter = "tac | sed '/\\\[-- Autoview/,+1d' | tac" # Suppress autoview messages. alternative_order text/plain text/enriched text/html bind index,pager i noop bind index,pager g noop From a22d223d7988538560b1227747699d16ff7114b2 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Wed, 28 Oct 2020 10:38:04 -0400 Subject: [PATCH 060/225] fix #557 --- bin/mw | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bin/mw b/bin/mw index e02d3ab..11d59e9 100755 --- a/bin/mw +++ b/bin/mw @@ -13,7 +13,6 @@ pass_prefix="mw-" muttdir="${XDG_CONFIG_HOME:-$HOME/.config}/mutt" # Main mutt config location accdir="$muttdir/accounts" # Directory for account settings maildir="${XDG_DATA_HOME:-$HOME/.local/share}/mail" # Location of mail storage -namere="^[a-z_][a-z0-9_-]*$" # Regex to ensure viable username emailre=".+@.+\..+" # Regex to confirm valid email address muttshare="$prefix/share/mutt-wizard" mbsyncrc="${MBSYNCRC:-$HOME/.mbsyncrc}" @@ -228,7 +227,7 @@ Trash Sent Archive" && return 0 if mailboxes="$(mbsync -l "$fulladdr" | sed 's/\//./')" >/dev/null 2>&1 && [ -n "$mailboxes" ]; then - [ "$accounttype" = "online" ] && sed -ibu "/IMAPStore $fulladdr-remote$/,/# End profile/d" "$mbsyncrc" ; rm -f "$mbsyncrc"bu + [ -n "${online+x}" ] && sed -ibu "/IMAPStore $fulladdr-remote$/,/# End profile/d" "$mbsyncrc" ; rm -f "$mbsyncrc"bu return 0 else echo "$mailboxes" @@ -290,7 +289,7 @@ setact() { if [ -n "${action+x}" ] && [ "$action" != "$1" ]; then trap 'echo -e "\033[0m\n"; exit' INT ABRT -while getopts "fplhdYD:y:i:I:s:S:u:a:n:x:" o; do case "${o}" in +while getopts "fplhodYD:y:i:I:s:S:u:a:n:x:m:" o; do case "${o}" in l) setact list || exit 1 ;; d) setact delete || exit 1 ;; D) setact delete || exit 1 ; fulladdr="$OPTARG" ;; @@ -308,7 +307,6 @@ while getopts "fplhdYD:y:i:I:s:S:u:a:n:x:" o; do case "${o}" in f) setact add || exit 1 ; force=True ;; x) setact add || exit 1 ; password="$OPTARG" ;; p) echo "NOTE: Protonmail users must install and configure Protonmail Bridge first for the first sync to work." - proton=True imap="127.0.0.1" iport="1143" smtp="127.0.0.1" From 40a58fb1bce260d22ec44519bc49cdb01829e921 Mon Sep 17 00:00:00 2001 From: Julian Marcos Date: Tue, 3 Nov 2020 17:05:04 +0100 Subject: [PATCH 061/225] Update domains.csv Add nixnet.email domains to domains.csv --- share/domains.csv | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/share/domains.csv b/share/domains.csv index d982ee8..a97b7c9 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -282,3 +282,11 @@ zju.edu.cn,imap.zju.edu.cn,993,smtp.zju.edu.cn,994 zoho.com,imap.zoho.com,993,smtp.zoho.com,465 zohomail.eu,imap.zoho.eu,993,smtp.zoho.eu,465 e.email,mail.ecloud.global,993.00,mail.ecloud.global,587.00 +nixnet.email,imap.nixnet.email,143,smtp.nixnet.email,587 +nixnetmail.com,imap.nixnet.email,143,smtp.nixnet.email,587 +pwned.life,imap.nixnet.email,143,smtp.nixnet.email,587 +paranoid.network,imap.nixnet.email,143,smtp.nixnet.email,587 +linux.monster,imap.nixnet.email,143,smtp.nixnet.email,587 +nixnet.xyz,imap.nixnet.email,143,smtp.nixnet.email,587 +freedom.xyz,imap.nixnet.email,143,smtp.nixnet.email,587 +privacy.xyz,imap.nixnet.email,143,smtp.nixnet.email,587 From 8ceb74de7d88d77eb098bf3e5e8f05e5ecbd8cd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ceylan=20Bozo=C4=9Fullar=C4=B1ndan?= Date: Sat, 14 Nov 2020 01:31:04 +0300 Subject: [PATCH 062/225] Erciyes University, New Configurations Erciyes University configuration is updated. --- share/domains.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/domains.csv b/share/domains.csv index 9350c76..7642c87 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -86,7 +86,7 @@ email.arizona.edu,imap.gmail.com,993,smtp.gmail.com,587 email.com,imap.mail.com,993,smtp.mail.com,587 eneco.com,outlook.office365.com,993,smtp.office365.com,587 engineer.com,imap.mail.com,993,smtp.mail.com,587 -erciyes.edu.tr,posta.erciyes.edu.tr,993,smtp.erciyes.edu.tr,587 +erciyes.edu.tr,mail.erciyes.edu.tr,993,mail.erciyes.edu.tr,587 ethancoe.com,mail.privateemail.com,993,mail.privateemail.com,465 ethz.ch,mail.ethz.ch,993,mail.ethz.ch,587 etu.upmc.fr,courriel.upmc.fr,993,smtps.upmc.fr,587 From a391791b7c9189a75fcf37e6cf8e3b88b25f621f Mon Sep 17 00:00:00 2001 From: pryme-svg Date: Mon, 16 Nov 2020 16:24:03 -0800 Subject: [PATCH 063/225] update domains.csv --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index 7642c87..8aeb04f 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -78,6 +78,7 @@ dicksinmyan.us,mail.cock.li,993,mail.cock.li,587 diplomats.com,imap.mail.com,993,smtp.mail.com,587 disroot.org,disroot.org,993,disroot.org,587 distruzione.org,mail.autistici.org,993,smtp.autistici.org,465 +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 e.email,mail.ecloud.global,993.00,mail.ecloud.global,587.00 From 50c197ac632a35f3d8d012596f872a7854475030 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 19 Nov 2020 09:20:37 -0500 Subject: [PATCH 064/225] attachment fix; documentation fixes --- README.md | 6 ++++-- bin/mw | 2 +- bin/openfile | 13 +++++++------ share/mutt-wizard.muttrc | 1 + 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 1027555..31118f1 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ The mutt-wizard is run with the command `mw`. Once everything is setup, you'll u #### Providing arguments -- `-u` -- Give an account username if different from the email address. If you use my [emailwiz](https://github.com/lukesmithxyz/emailwiz), give your username with this option. Not necessary for other accounts. +- `-u` -- Give an account username if different from the email address. - `-n` -- A real name to be used by the account. Put in quotations if multiple words - `-i` -- IMAP server address - `-I` -- IMAP server port (otherwise assumed to be 993) @@ -65,10 +65,10 @@ There's a chance of errors if you use a slow-release distro like Ubuntu, Debian ### Optional +- `pam-gnupg` - Automatically logs you into your GPG key on login so you will never need to input your password once logged on to your system. Check the repo and directions out [here](https://github.com/cruegge/pam-gnupg). - `lynx` - view HTML email in neomutt. - `notmuch` - index and search mail. Install it and run `notmuch setup`, tell it that your mail is in `~/.local/share/mail/` (although `mw` will do this automatically if you haven't set notmuch up before). You can run it in mutt with `ctrl-f`. Run `notmuch new` to process new mail. - `abook` - a terminal-based address book. Pressing tab while typing an address to send mail to will suggest contacts that are in your abook. -- `pam-gnupg` - this is a more general program that I use. It automatically logs you into your GPG key on login so you will never need to input your password once logged on to your system. Check the repo and directions out [here](https://github.com/cruegge/pam-gnupg). - `urlview` - outputs urls in mail to browser. ## Neomutt user interface @@ -88,8 +88,10 @@ To give you an example of the interface, here's an idea: - `?` - see all keyboard shortcuts - `ctrl-j`/`ctrl-k` - move up and down in sidebar, `ctrl-o` opens mailbox. - `ctrl-b` - open a menu to select a url you want to open in you browser. +- ## New stuff and improvements since the original release +- `mw` is now scriptable with command-line options and can run successfully without any interaction, making it possible to deploy in a script. - `isync`/`mbsync` has replaced `offlineimap` as the backend. Offlineimap was error-prone, bloated, used obsolete Python 2 modules and required separate steps to install the system. - `mw` is now an installed program instead of just a script needed to be kept in your mutt folder. - `dialog` is no longer used (le bloat) and the interface is simply text commands. diff --git a/bin/mw b/bin/mw index af4d785..9385bf5 100755 --- a/bin/mw +++ b/bin/mw @@ -337,7 +337,7 @@ Options allowed with -a: -x Password for account (recommended to be in double quotes) -p Install for a Protonmail account. -o Configure address, but keep mail online. - -b Assume typical English mailboxes without attempting log-on. + -f Assume typical English mailboxes without attempting log-on. NOTE: Once at least one account is added, you can run \`mbsync -a\` to begin downloading mail. diff --git a/bin/openfile b/bin/openfile index f6668dc..cf3c6c3 100755 --- a/bin/openfile +++ b/bin/openfile @@ -1,9 +1,10 @@ #!/bin/sh # Helps open a file with xdg-open from mutt in a external program without weird side effects. -[ "$(uname)" = "Darwin" ] && opener="open" || opener="setsid xdg-open" -mkdir -p "/tmp/$USER-mutt-tmp" -file="/tmp/$USER-mutt-tmp/$(basename "$1")" -rm -f "$file" -cp "$1" "$file" -$opener "$file" >/dev/null 2>&1 & +tempdir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard/files" +file="$tempdir/$(basename "$1")" +[ "$(uname)" = "Darwin" ] && opener="open" || opener="setsid -f xdg-open" +mkdir -p "$tempdir" +cp -f "$1" "$file" +$opener "$file" >/dev/null 2>&1 +find "${tempdir:?}" -mtime +1 -type f -delete diff --git a/share/mutt-wizard.muttrc b/share/mutt-wizard.muttrc index 94401e8..f40063d 100644 --- a/share/mutt-wizard.muttrc +++ b/share/mutt-wizard.muttrc @@ -4,6 +4,7 @@ # In the interest of seamless updating, do not edit this file. # If you want to override any settings, set those in your muttrc. set mailcap_path = /usr/local/share/mutt-wizard/mailcap +set mime_type_query_command = "file --mime-type -b %s" set date_format="%y/%m/%d %I:%M%p" set index_format="%2C %Z %?X?A& ? %D %-15.15F %s (%-4.4c)" set sort = 'reverse-date' From 44c70edd8175acb1a0d717c32e4048265c65cb8a Mon Sep 17 00:00:00 2001 From: Vlad Doster Date: Sat, 21 Nov 2020 02:06:33 -0600 Subject: [PATCH 065/225] Update README.md - Fix formatting, typos, and make the format cohesive. - Move LICENSE to defacto spot and more prominent - Move dependencies sections to be a sub-section of the Install section since it was a bit confusing as to why the dependencies were after the Install section. --- README.md | 198 +++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 135 insertions(+), 63 deletions(-) diff --git a/README.md b/README.md index 31118f1..4b5d99d 100644 --- a/README.md +++ b/README.md @@ -3,29 +3,52 @@ Get this great stuff without effort: - A full-featured and autoconfigured email client on the terminal with neomutt -- Mail stored offline so you can view and write email while you're away from internet and keep backups +- Mail stored offline enabling the ability to: + * view and write emails while you're away from + the internet + * make backups Specifically, this wizard: - Determines your email server's IMAP and SMTP servers and ports -- Creates dotfiles for `neomutt`, `isync`, and `msmtp` appropriate for your email address -- Encrypts and locally stores your password for easy remote access, accessible only by your GPG key +- Creates dotfiles for `neomutt`, `isync`, and `msmtp` appropriate for your + email address +- Encrypts and locally stores your password for easy remote access, accessible + only by your GPG key - Handles as many as nine separate email accounts automatically - Auto-creates bindings to switch between accounts or between mailboxes -- Provides sensible defaults and an attractive appearance for the neomutt email client -- If mutt-wizard doesn't know your server's IMAP/SMTP info by default, it will prompt you for them and will put them in all the right places. +- Provides sensible defaults and an attractive appearance for the neomutt email + client +- If mutt-wizard doesn't know your server's IMAP/SMTP info by default, it will + prompt you for them and will put them in all the right places. -## Install and Use +## Install -``` +#### Dependencies + +- `neomutt` - the email client. +- `isync` - downloads and syncs the mail. (required at install) +- `msmtp` - sends the email. +- `pass` - safely encrypts passwords (required at install) + +**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 recent version +manually or manually remove the offending lines in the config in +`/usr/share/mutt-wizard/mutt-wizard.muttrc`. + +```bash git clone https://github.com/LukeSmithxyz/mutt-wizard cd mutt-wizard sudo make install ``` -User of Arch-based distros can also install mutt-wizard from the AUR as [mutt-wizard-git](https://aur.archlinux.org/packages/mutt-wizard-git/). +A user of Arch-based distros can also install mutt-wizard from the AUR as +[mutt-wizard-git](https://aur.archlinux.org/packages/mutt-wizard-git/). + +## Usage -The mutt-wizard is run with the command `mw`. Once everything is setup, you'll use `neomutt` to access your mail. +The mutt-wizard runs via the command `mw`. Once setup is complete, you'll use +`neomutt` to access your mail. - `mw -a you@email.com` -- add a new email account - `mw -l` -- list existing accounts @@ -40,96 +63,145 @@ The mutt-wizard is run with the command `mw`. Once everything is setup, you'll u #### Providing arguments - `-u` -- Give an account username if different from the email address. -- `-n` -- A real name to be used by the account. Put in quotations if multiple words +- `-n` -- A real name to be used by the account. Put in quotations if multiple + words - `-i` -- IMAP server address - `-I` -- IMAP server port (otherwise assumed to be 993) - `-s` -- SMTP server address - `-S` -- SMTP server port (otherwise assumed to be 587) -- `-m` -- Maximum number of emails to be kept offline. No maximum is default functionality. +- `-m` -- Maximum number of emails to be kept offline. No maximum is default + functionality. - `-x` -- Account password. You will be prompted for it otherwise. #### General Settings -- `-p` -- Add a Protonmail account -- `-f` -- Assume mailbox names and force account configuration without connecting online at all. +- `-p` -- Add a Protonmail account. +- `-f` -- Assume mailbox names and force account configuration without + connecting online at all. - `-o` -- Configure mutt for an account, but do not keep mail offline. -## Dependencies - -- `neomutt` - the email client. -- `isync` - downloads and syncs the mail. (required at install) -- `msmtp` - sends the email. -- `pass` - safely encrypts passwords (required at install) - -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 recent version manually or manually remove the offending lines in the config in `/usr/share/mutt-wizard/mutt-wizard.muttrc`. - -### Optional - -- `pam-gnupg` - Automatically logs you into your GPG key on login so you will never need to input your password once logged on to your system. Check the repo and directions out [here](https://github.com/cruegge/pam-gnupg). -- `lynx` - view HTML email in neomutt. -- `notmuch` - index and search mail. Install it and run `notmuch setup`, tell it that your mail is in `~/.local/share/mail/` (although `mw` will do this automatically if you haven't set notmuch up before). You can run it in mutt with `ctrl-f`. Run `notmuch new` to process new mail. -- `abook` - a terminal-based address book. Pressing tab while typing an address to send mail to will suggest contacts that are in your abook. -- `urlview` - outputs urls in mail to browser. - ## Neomutt user interface To give you an example of the interface, here's an idea: - `m` - send mail (uses your default `$EDITOR` to write) -- `j`/`k` and `d`/`u` - vim-like bindings to go down and up (or `d`/`u` to go down/up a page). +- `j`/`k` and `d`/`u` - vim-like bindings to go down and up (or `d`/`u` to go + down/up a page). - `l` - open mail, or attachment page or attachment - `h` - the opposite of `l` - `r`/`R` - reply/reply all to highlighted mail - `s` - save selected mail or selected attachment -- `gs`,`gi`,`ga`,`gd`,`gS` - Press `g` followed by another letter to change mailbox: `s`ent, `i`nbox, `a`rchive, `d`rafts, `S`pam, etc. -- `M` and `C` - For `M`ove and `C`opy: follow them with one of the mailbox letters above, i.e. `MS` means "move to Spam". -- `i#` - Press `i` followed by a number 1-9 to go to a different account. If you add 9 accounts via mutt-wizard, they will each be assigned a number. -- `a` to add address/person to abook and `Tab` while typing address to complete one from book. +- `gs`,`gi`,`ga`,`gd`,`gS` - Press `g` followed by another letter to change + mailbox: `s`ent, `i`nbox, `a`rchive, `d`rafts, `S`pam, etc. +- `M` and `C` - For `M`ove and `C`opy: follow them with one of the mailbox + letters above, i.e. `MS` means "move to Spam". +- `i#` - Press `i` followed by a number 1-9 to go to a different account. If you + add 9 accounts via mutt-wizard, they will each be assigned a number. +- `a` to add address/person to abook and `Tab` while typing address to complete + one from abook. - `?` - see all keyboard shortcuts - `ctrl-j`/`ctrl-k` - move up and down in sidebar, `ctrl-o` opens mailbox. -- `ctrl-b` - open a menu to select a url you want to open in you browser. -- +- `ctrl-b` - open a menu to select a URL you want to open in your browser. + +## Additional functionality + +- `pam-gnupg` - Automatically logs you into your GPG key on login, so you will + never need to input your password once logged on to your system. Check the + repo and directions out [here](https://github.com/cruegge/pam-gnupg). +- `lynx` - View HTML email in neomutt. +- `notmuch` - Index and search mail. Install it and run `notmuch setup`, tell it + that your mail is in `~/.local/share/mail/` (although `mw` will do this + automatically if you haven't set notmuch up before). You can run it in mutt + with `ctrl-f`. Run `notmuch new` to process new mail. +- `abook` - A terminal-based address book. Pressing tab while typing an address + to send mail to will suggest contacts that are in your abook. +- `urlview` - Outputs URLs in an email to your browser. + ## New stuff and improvements since the original release -- `mw` is now scriptable with command-line options and can run successfully without any interaction, making it possible to deploy in a script. -- `isync`/`mbsync` has replaced `offlineimap` as the backend. Offlineimap was error-prone, bloated, used obsolete Python 2 modules and required separate steps to install the system. -- `mw` is now an installed program instead of just a script needed to be kept in your mutt folder. -- `dialog` is no longer used (le bloat) and the interface is simply text commands. -- More autogenerated shortcuts that allow quickly moving and copying mail between boxes. -- More elegant attachment handling. Image/video/pdf attachments without relying on the neomutt instance. +- `mw` is now scriptable with command-line options and can run successfully + without any interaction, making it possible to deploy in a script. +- `isync`/`mbsync` has replaced `offlineimap` as the backend. Offlineimap was + error-prone, bloated, used obsolete Python 2 modules, and required separate + steps to install the system. +- `mw` is now an installed program instead of just a script needed to be kept in + your mutt folder. +- `dialog` is no longer used (i.e. bloat) and the interface is simply text + commands. +- More autogenerated shortcuts that allow quickly moving and copying mail + between boxes. +- More elegant attachment handling. Image/video/pdf attachments without relying + on the neomutt instance. - abook integration by default. -- The messy template files and other directories have been moved or removed, leaving a clean config folder. -- msmtp configs moved to `~/.config/` and mail default location moved to `~/.local/share/mail/`, reducing mess in `~`. +- The messy template files and other directories have been moved or removed, + leaving a clean config folder. +- msmtp configs moved to `~/.config/` and mail default location moved to + `~/.local/share/mail/`, reducing mess in `~`. - `pass` is used as a password manager instead of separately saving passwords. - Script is POSIX sh compliant. -- Error handling for the many people who don't read or follow directions. Less errors generally. +- Error handling for the many people who don't read or follow directions. Fewer + errors, generally. - Addition of a manual `man mw` ## Help the Project! -- Try mutt-wizard out on weird machines and weird email addresses and report any errors. -- Open a PR to add new server information into `domains.csv` so their users can more easily use mutt-wizard. +- Try mutt-wizard out on weird machines and weird email addresses and report any + errors. +- Open a PR to add new server information into `domains.csv` so their users can + more easily use mutt-wizard. - If nothing else, [Donate!](https://paypal.me/LukeMSmith) -See Luke's website [here](https://lukesmith.xyz). Email him at [luke@lukesmith.xyz](mailto:luke@lukesmith.xyz). - -mutt-wizard is free/libre software, licensed under the GPLv3. +See Luke's website [here](https://lukesmith.xyz). Email him at +[luke@lukesmith.xyz](mailto:luke@lukesmith.xyz). ## Details for Tinkerers - The critical `mutt`/`neomutt` files are in `~/.config/mutt/`. -- Put whatever global settings you want in `muttrc`. mutt-wizard will add some lines to this file which you shouldn't remove unless you know what you're doing, but you can move them up/down over your personal config lines if you need to. If you get binding conflict errors in mutt, you might need to do this. -- Each of the accounts that mutt-wizard generates will have custom settings set in a separate file in `accounts/`. You can edit these freely if you want to tinker with settings specific to an account. -- In `/usr/share/mutt-wizard` are several global config files, including `mutt-wizard`'s default settings. You can overwride this in your `muttrc` if you wish. - -## Watch out for these things: -- Gmail accounts can now create 'App Password' to use with """less secure""" applications. This password is single use (ie. for setup) and will be stored and encrypted locally. Enabling third-party applications requires turning off two-factor authentication and this will circumvent that. You might also need to manually "Enable IMAP" in the settings. -- Protonmail accounts will require you to set up "Protonmail Bridge" to access PM's IMAP and SMTP servers. Configure that before running mutt-wizard. Note that when mutt-wizard asks for a password, you should put in your [bridge password](https://protonmail.com/bridge/thunderbird#3), not your account password. -- Protonmail bridge is prone to timing out. Watch out for this while adding an account. If the bridge times out, try again. It might help to [increase the timeout](https://protonmail.com/support/knowledge-base/thunderbird-connection-server-timed-error/) in your `mbsyncrc`. -- 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. - - `isync` is not fully UTF-8 compatible, so non-Latin characters may be garbled (although sync should succeed). `mw` will also not autocreate mailbox shortcuts since it is looking for English mailbox names. I strongly recommend you to set your email language to English on your mail server to avoid these problems. +- Put whatever global settings you want in `muttrc`. mutt-wizard will add some + lines to this file, which you shouldn't remove unless you know what you're + doing, but you can move them up/down over your config lines if you need to. If + you get binding conflict errors in mutt, you might need to do this. +- Each of the accounts that mutt-wizard generates will have custom settings set + in a separate file in `accounts/`. You can edit these freely if you want to + tinker with settings specific to an account. +- In `/usr/share/mutt-wizard` are several global config files, including + `mutt-wizard`'s default settings. You can override this in your `muttrc` if + you wish. + +## Watch out for these things + +- Gmail accounts need to create an [App + Password](https://support.google.com/accounts/answer/185833?hl=en) to use + with _**less secure**_ applications. This password is single-use (i.e. for + setup) and will be stored and encrypted locally. Enabling third-party + applications requires turning off two-factor authentication and this will + circumvent that. You might also need to manually "Enable IMAP" in the + settings. +- Protonmail accounts require a "Protonmail Bridge" to access + PM's IMAP and SMTP servers. Configure that before running mutt-wizard. Note + that when mutt-wizard asks for a password, you should put in your [bridge + password](https://protonmail.com/bridge/thunderbird#3), not your account + password. +- Protonmail bridge is prone to timing out. Watch out for this while adding an + account. If the bridge times out, try again. It might help to [increase the + timeout](https://protonmail.com/support/knowledge-base/thunderbird-connection-server-timed-error/) + in your `mbsyncrc`. +- 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. + - `isync` is not fully UTF-8 compatible, so non-Latin characters may be garbled + (although sync should succeed). `mw` will also not auto-create mailbox + shortcuts since it is looking for English mailbox names. I strongly recommend + you to set your email language to English on your mail server to avoid these + problems. ## To-do -- Add ~~Mac OS~~/~~BSD~~ compatibility (the script is confirmed to work for Mac OS and FreeBSD now) -- ~~Out-of-the-box compatibility with Protonmail Bridge~~ (I believe this is done, but more bug-testing is welcome since I don't have PM) +- [x] Add Mac OS/BSD compatibility + +- [x] Out-of-the-box compatibility with Protonmail Bridge (I believe this is + done, but more bug-testing is welcome since I don't have PM) + +## License + +[mutt-wizard](https://github.com/LukeSmithxyz/mutt-wizard) is free/libre software. This program is released under the GPLv3 license, which you can find in the file [LICENSE](LICENSE). From 4228837d3dabd4ab11a55aeba1c052a9776497d2 Mon Sep 17 00:00:00 2001 From: Rodrigo Camacho Date: Mon, 23 Nov 2020 14:03:13 -0600 Subject: [PATCH 066/225] Formatting changes, precision to TFA google --- mw.1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mw.1 b/mw.1 index 3ed4d95..8c407e9 100644 --- a/mw.1 +++ b/mw.1 @@ -121,9 +121,11 @@ If you would like to help develop mutt-wizard for others, you are invited to add on mutt-wizard's Github or Gitlab pages. .TP .B Gmail accounts -Google will require you to allow "less-secure" (third party) applications or use two-factor authentication in order to access their IMAP servers to download your mail. If you use Gmail, be sure to handle this before running mutt-wizard . +Google will require you to allow "less-secure" (third party) applications or remove two-factor authentication in order to access their IMAP servers to download your mail. If you use Gmail, be sure to handle this before running mutt-wizard . +.TP .B Protonmail accounts Protonmail users must use the Protonmail Bridge to access their IMAP and SMTP servers. This too should be configured before running mutt-wizard. +.TP .B Enterprise and university accounts Many universities and businesses might host their domain's email via Google or another service. This often requires a special IMAP/SMTP-specific password that you must generate and use. Again, mutt-wizard can handle these systems, but only once they've been set up. .TP From 59322fb546479f51045752e74c966b96d847cb81 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Mon, 23 Nov 2020 17:45:56 -0500 Subject: [PATCH 067/225] remove tac line until further fix cloeses #577 #572 --- 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 f40063d..a9484f3 100644 --- a/share/mutt-wizard.muttrc +++ b/share/mutt-wizard.muttrc @@ -25,7 +25,7 @@ set include # include message in replies set mail_check=60 # to avoid lags using IMAP with some email providers (yahoo for example) auto_view text/html # automatically show html (mailcap uses lynx) auto_view application/pgp-encrypted -set display_filter = "tac | sed '/\\\[-- Autoview/,+1d' | tac" # Suppress autoview messages. +#set display_filter = "tac | sed '/\\\[-- Autoview/,+1d' | tac" # Suppress autoview messages. alternative_order text/plain text/enriched text/html bind index,pager i noop bind index,pager g noop From ebf3d31a4a22db310966811d804f6f636d02ea58 Mon Sep 17 00:00:00 2001 From: Horea Christian Date: Wed, 25 Nov 2020 08:06:43 -0500 Subject: [PATCH 068/225] update domains.csv --- share/domains.csv | 2 ++ 1 file changed, 2 insertions(+) diff --git a/share/domains.csv b/share/domains.csv index 8aeb04f..c947c81 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -35,6 +35,7 @@ bguth.de,wp300.webpack.hosteurope.de,993,wp300.webpack.hosteurope.de,587 bigpond.com,imap.telstra.com,143,smtp.telstra.com,587 bikerider.com,imap.mail.com,993,smtp.mail.com,587 billycarlyle.uk,mail.muny.us,993,mail.muny.us,465 +biomed.ee.ethz.ch,mail.ethz.ch,993,mail.ethz.ch,587 birdlover.com,imap.mail.com,993,smtp.mail.com,587 bjoernguthphotography.de,wp300.webpack.hosteurope.de,993,wp300.webpack.hosteurope.de,587 bocken.org,mail.bocken.org,993,mail.bocken.org,587 @@ -162,6 +163,7 @@ mailo.com,mail.mailo.com,993,mail.mailo.com,465 marquette.edu,outlook.office365.com,993,smtp.office365.com,587 memeware.net,mail.cock.li,993,mail.cock.li,587 metu.edu.tr,imap.metu.edu.tr,993,smtp.metu.edu.tr,465 +mit.edu,imap.exchange.mit.edu,993,outgoing.mit.edu,465 ml1.net,imap.fastmail.com,993,smtp.fastmail.com,465 mortemale.org,mail.autistici.org,993,smtp.autistici.org,465 msn.com,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 From 6abcf7073e93b0c40373bef060f51ee006a8a00e Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 26 Nov 2020 20:37:27 -0500 Subject: [PATCH 069/225] check for inbox match last in case a subdirectory under the inbox is used for something else closes #581 --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mw b/bin/mw index 9385bf5..c622398 100755 --- a/bin/mw +++ b/bin/mw @@ -240,13 +240,13 @@ finalize() { echo "$mailboxes" | xargs -I {} mkdir -p "$maildir/$fulladdr/{}/cur toappend="mailboxes $(echo "$mailboxes" | sed "s/^/\"=/;s/$/\"/" | paste -sd ' ' )" for x in $mailboxes; do case $x in - *[Ii][Nn][Bb][Oo][Xx]*) formatShortcut i inbox "$x"; setBox spoolfile "$x" ;; *[Ss][Ee][Nn][Tt]*) setBox record "$x"; formatShortcut s sent "$x" ;; *[Dd][Rr][Aa][Ff][Tt][Ss]*) setBox postponed "$x"; formatShortcut d drafts "$x" ;; *[Tt][Rr][Aa][Ss][Hh]*) formatShortcut t trash "$x"; setBox trash "$x" ;; *[Jj][Uu][Nn][Kk]*) formatShortcut j junk "$x" ;; *[Aa][Rr][Cc][Hh][Ii][Vv][Ee]*) formatShortcut a archive "$x" ;; *[Ss][Pp][Aa][Mm]*) formatShortcut S spam "$x" ;; + *[Ii][Nn][Bb][Oo][Xx]*) formatShortcut i inbox "$x"; setBox spoolfile "$x" ;; esac done echo "$toappend" >> "$accdir/$idnum-$fulladdr.muttrc" From 15fafc21387d1ed0461a2e067e18d743acbbbae4 Mon Sep 17 00:00:00 2001 From: HelloHelo <66974557+Hello-Helo@users.noreply.github.com> Date: Sun, 29 Nov 2020 17:10:21 -0300 Subject: [PATCH 070/225] Add USP-BR email --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index c947c81..9dace1d 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -266,6 +266,7 @@ univ-ubs.fr,partage.univ-ubs.fr,993,partage.univ-ubs.fr,587 uoregon.edu,imap.uoregon.edu,993,smtp.uoregon.edu,587 uqtr.ca,outlook.office365.com,993,smtp.office365.com,587 usa.com,imap.mail.com,993,smtp.mail.com,587 +usp.br,imap.gmail.com,993,smtp.gmail.com,465 utas.edu.au,outlook.office365.com,993,smtp.office365.com,587 utdallas.edu,outlook.office365.com,993,smtp.office365.com,587 uw.edu,imap.gmail.com,993,smtp.gmail.com,465 From 6c358df400f3dad2b1573954a1ee181b84836c9b Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 4 Dec 2020 05:53:05 -0500 Subject: [PATCH 071/225] fix #588 --- bin/mw | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/mw b/bin/mw index c622398..8f24118 100755 --- a/bin/mw +++ b/bin/mw @@ -5,7 +5,7 @@ command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2" [ -r "$PASSWORD_STORE_DIR/.gpg-id" ] && "$GPG" --list-secret-keys $(cat "$PASSWORD_STORE_DIR/.gpg-id") >/dev/null 2>&1 || { printf "\`pass\` must be installed and initialized to encrypt passwords.\\nBe sure it is installed and run \`pass init \`.\\nIf you don't have a GPG public private key pair, run \`%s --full-gen-key\` first.\\n" "$GPG" - exit + exit 1 } prefix="/usr/local" @@ -348,7 +348,7 @@ exit 1 ;; esac done -! command -v mbsync >/dev/null && [ -z "${force+x}" ] && printf "\`mbsync (isync package)\` must be installed to run mutt-wizard.\\n" && exit +! command -v mbsync >/dev/null && [ -z "${force+x}" ] && printf "\`mbsync (isync package)\` must be installed to run mutt-wizard.\\n" && exit 1 case "$action" in list) list ;; From 456d02d1ee0ab196ac256b91c9ac86a01f3c0bb6 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 10 Dec 2020 06:14:50 -0500 Subject: [PATCH 072/225] fix #595 --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mw b/bin/mw index 8f24118..d179368 100755 --- a/bin/mw +++ b/bin/mw @@ -239,7 +239,7 @@ finalize() { echo "$mailboxes" | xargs -I {} mkdir -p "$maildir/$fulladdr/{}/cur sed -ibu "/$MARKER/d" "$accdir/$idnum-$fulladdr.muttrc" ; rm -f "$accdir/$idnum-$fulladdr.muttrcbu" toappend="mailboxes $(echo "$mailboxes" | sed "s/^/\"=/;s/$/\"/" | paste -sd ' ' )" for x in $mailboxes; do - case $x in + case "$x" in *[Ss][Ee][Nn][Tt]*) setBox record "$x"; formatShortcut s sent "$x" ;; *[Dd][Rr][Aa][Ff][Tt][Ss]*) setBox postponed "$x"; formatShortcut d drafts "$x" ;; *[Tt][Rr][Aa][Ss][Hh]*) formatShortcut t trash "$x"; setBox trash "$x" ;; From 3d7546974adfa89a1526ac507622a0f8689b6fbf Mon Sep 17 00:00:00 2001 From: Ethan Rietz Date: Tue, 15 Dec 2020 21:45:53 -0500 Subject: [PATCH 073/225] Fix mailboxes on macos The Mac version of paste requires "-" to read from STDIN. Without "-", the "mailboxes" line in ~/.config/accounts/.muttrc is empty upon adding a new mailbox via `mw -a `. The Linux version of paste works fine if "-" is added. --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mw b/bin/mw index d179368..a19d1e4 100755 --- a/bin/mw +++ b/bin/mw @@ -237,7 +237,7 @@ Archive" && return 0 finalize() { echo "$mailboxes" | xargs -I {} mkdir -p "$maildir/$fulladdr/{}/cur" "$maildir/$fulladdr/{}/tmp" "$maildir/$fulladdr/{}/new" sed -ibu "/$MARKER/d" "$accdir/$idnum-$fulladdr.muttrc" ; rm -f "$accdir/$idnum-$fulladdr.muttrcbu" - toappend="mailboxes $(echo "$mailboxes" | sed "s/^/\"=/;s/$/\"/" | paste -sd ' ' )" + toappend="mailboxes $(echo "$mailboxes" | sed "s/^/\"=/;s/$/\"/" | paste -sd ' ' - )" for x in $mailboxes; do case "$x" in *[Ss][Ee][Nn][Tt]*) setBox record "$x"; formatShortcut s sent "$x" ;; From 04ab5439bbf362a5eefd6937d9b1890f9e8648c0 Mon Sep 17 00:00:00 2001 From: MineralwaterXu Date: Thu, 17 Dec 2020 13:26:00 +0800 Subject: [PATCH 074/225] Add shu.edu.cn email --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index 9dace1d..64dcf80 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -219,6 +219,7 @@ runbox.com,mail.runbox.com,993,mail.runbox.com,587 rwth-aachen.de,mail.rwth-aachen.de,993,mail.rwth-aachen.de,587 sapo.pt,imap.sapo.pt,993,smtp.sapo.pt,587 seznam.cz,imap.seznam.cz,993,smtp.seznam.cz,465 +shu.edu.cn,imap.shu.edu.cn,143,smtp.shu.edu.cn,25 smail.inf.h-brs.de,imap.inf.h-brs.de,993,smtp.inf.h-brs.de,587 sms.ed.ac.uk,pod51015.outlook.com,993,pod51015.outlook.com,587 southwales.ac.uk,imap.gmail.com,993,smtp.gmail.com,587 From 30c4647c98e2e04b86ef6189bf7974b1a3bc20bd Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 24 Dec 2020 20:40:17 -0500 Subject: [PATCH 075/225] don't readd same account. fix #558 --- bin/mw | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/mw b/bin/mw index d179368..61e7592 100755 --- a/bin/mw +++ b/bin/mw @@ -164,6 +164,8 @@ askinfo() { \ echo "\`$fulladdr\` is not a valid email address. Please retype the address:" read -r fulladdr done + grep -q "Channel\s*$fulladdr$" "$mbsyncrc" && + { 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 From a434ac50feb1f6e3142a18d5db0c22c8012cd05a Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 24 Dec 2020 20:43:27 -0500 Subject: [PATCH 076/225] fix #596 --- bin/mw | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/mw b/bin/mw index 5a923c8..a207d4e 100755 --- a/bin/mw +++ b/bin/mw @@ -95,6 +95,7 @@ bind index,pager C noop bind index gg first-entry macro index o \"mw -y $fulladdr\" \"run mbsync to sync $fulladdr\" unmailboxes * +unalternates * " else mutt_profile="# vim: filetype=neomuttrc From 33fd62bcf156b74ba3866e234425f637b71e1359 Mon Sep 17 00:00:00 2001 From: Novite5 Date: Wed, 30 Dec 2020 21:26:14 +0800 Subject: [PATCH 077/225] add Sina and Sohu Mail --- share/domains.csv | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/share/domains.csv b/share/domains.csv index 64dcf80..65251d6 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -1,8 +1,8 @@ +ADDRESS,IMAP,imap port,SMTP,smtp port 126.com,imap.126.com,993,smtp.126.com,587 163.com,imap.163.com,993,smtp.163.com,587 420blaze.it,mail.cock.li,993,mail.cock.li,587 8chan.co,mail.cock.li,993,mail.cock.li,587 -ADDRESS,IMAP,imap port,SMTP,smtp port aaathats3as.com,mail.cock.li,993,mail.cock.li,587 accountant.com,imap.mail.com,993,smtp.mail.com,587 activist.com,imap.mail.com,993,smtp.mail.com,587 @@ -220,8 +220,11 @@ rwth-aachen.de,mail.rwth-aachen.de,993,mail.rwth-aachen.de,587 sapo.pt,imap.sapo.pt,993,smtp.sapo.pt,587 seznam.cz,imap.seznam.cz,993,smtp.seznam.cz,465 shu.edu.cn,imap.shu.edu.cn,143,smtp.shu.edu.cn,25 +sina.com,imap.sina.com,993,smtp.sina.com,587 +sina.cn,imap.sina.cn,993,smtp.sina.cn,587 smail.inf.h-brs.de,imap.inf.h-brs.de,993,smtp.inf.h-brs.de,587 sms.ed.ac.uk,pod51015.outlook.com,993,pod51015.outlook.com,587 +sohu.com,imap.sohu.com,143,smtp.sohu.com,25 southwales.ac.uk,imap.gmail.com,993,smtp.gmail.com,587 spoko.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465 st.amu.edu.pl,outlook.office365.com,993,smtp.office365.com,587 From f589cd4dfdd00f8521c09548b77cba6f995f89a5 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 31 Dec 2020 12:28:15 -0500 Subject: [PATCH 078/225] workable mailsync readded to enable autosync the new script manually searches for environmental variables so that it can work from a cronjob and additionally searches for all Xorg displays on Linux so that the display notification should appear correctly no doubt there will be more bugs, but this is what the people want and it's worth working out --- README.md | 107 +++++++++++++++++++++++++++++++++++++++------------ bin/mailsync | 98 ++++++++++++++++++++++++++++++++++++++++++++++ bin/mw | 46 +++++++++++++--------- mw.1 | 13 +++++++ 4 files changed, 221 insertions(+), 43 deletions(-) create mode 100755 bin/mailsync diff --git a/README.md b/README.md index 31118f1..fc6999a 100644 --- a/README.md +++ b/README.md @@ -3,17 +3,24 @@ Get this great stuff without effort: - A full-featured and autoconfigured email client on the terminal with neomutt -- Mail stored offline so you can view and write email while you're away from internet and keep backups +- Mail stored offline so you can view and write email while you're away from + internet and keep backups +- Provides a `mailsync` script that can be scheduled to run as often as you + like, which downloads/syncs mail and notifies you when new mail has arrived. Specifically, this wizard: - Determines your email server's IMAP and SMTP servers and ports -- Creates dotfiles for `neomutt`, `isync`, and `msmtp` appropriate for your email address -- Encrypts and locally stores your password for easy remote access, accessible only by your GPG key +- Creates dotfiles for `neomutt`, `isync`, and `msmtp` appropriate for your + email address +- Encrypts and locally stores your password for easy remote access, accessible + only by your GPG key - Handles as many as nine separate email accounts automatically - Auto-creates bindings to switch between accounts or between mailboxes -- Provides sensible defaults and an attractive appearance for the neomutt email client -- If mutt-wizard doesn't know your server's IMAP/SMTP info by default, it will prompt you for them and will put them in all the right places. +- Provides sensible defaults and an attractive appearance for the neomutt email + client +- If mutt-wizard doesn't know your server's IMAP/SMTP info by default, it will + prompt you for them and will put them in all the right places. ## Install and Use @@ -33,6 +40,8 @@ The mutt-wizard is run with the command `mw`. Once everything is setup, you'll u - `mw -Y` -- sync all configured email accounts - `mw -d` -- choose an account to delete - `mw -D your@email.com` -- delete account settings without confirmation +- `mw -t 30` -- toggle automatic mailsync to every 30 minutes +- `mw -T` -- toggle mailsync without specifying minutes (default is 10) - `pass edit mw-your@email.com` -- revise an account's password ### Options usable when adding an account @@ -70,6 +79,7 @@ There's a chance of errors if you use a slow-release distro like Ubuntu, Debian - `notmuch` - index and search mail. Install it and run `notmuch setup`, tell it that your mail is in `~/.local/share/mail/` (although `mw` will do this automatically if you haven't set notmuch up before). You can run it in mutt with `ctrl-f`. Run `notmuch new` to process new mail. - `abook` - a terminal-based address book. Pressing tab while typing an address to send mail to will suggest contacts that are in your abook. - `urlview` - outputs urls in mail to browser. +- `cronie` - (or any other major cronjob manager) to set up automatic mail syncing. ## Neomutt user interface @@ -91,43 +101,90 @@ To give you an example of the interface, here's an idea: - ## New stuff and improvements since the original release -- `mw` is now scriptable with command-line options and can run successfully without any interaction, making it possible to deploy in a script. -- `isync`/`mbsync` has replaced `offlineimap` as the backend. Offlineimap was error-prone, bloated, used obsolete Python 2 modules and required separate steps to install the system. -- `mw` is now an installed program instead of just a script needed to be kept in your mutt folder. -- `dialog` is no longer used (le bloat) and the interface is simply text commands. -- More autogenerated shortcuts that allow quickly moving and copying mail between boxes. -- More elegant attachment handling. Image/video/pdf attachments without relying on the neomutt instance. +- `mw` is now scriptable with command-line options and can run successfully + without any interaction, making it possible to deploy in a script. +- `isync`/`mbsync` has replaced `offlineimap` as the backend. Offlineimap was + error-prone, bloated, used obsolete Python 2 modules and required separate + steps to install the system. +- `mw` is now an installed program instead of just a script needed to be kept + in your mutt folder. +- `dialog` is no longer used (le bloat) and the interface is simply text + commands. +- More autogenerated shortcuts that allow quickly moving and copying mail + between boxes. +- More elegant attachment handling. Image/video/pdf attachments without relying + on the neomutt instance. - abook integration by default. -- The messy template files and other directories have been moved or removed, leaving a clean config folder. -- msmtp configs moved to `~/.config/` and mail default location moved to `~/.local/share/mail/`, reducing mess in `~`. +- The messy template files and other directories have been moved or removed, + leaving a clean config folder. +- msmtp configs moved to `~/.config/` and mail default location moved to + `~/.local/share/mail/`, reducing mess in `~`. - `pass` is used as a password manager instead of separately saving passwords. - Script is POSIX sh compliant. -- Error handling for the many people who don't read or follow directions. Less errors generally. +- Error handling for the many people who don't read or follow directions. Less + errors generally. - Addition of a manual `man mw` ## Help the Project! -- Try mutt-wizard out on weird machines and weird email addresses and report any errors. -- Open a PR to add new server information into `domains.csv` so their users can more easily use mutt-wizard. +- Try mutt-wizard out on weird machines and weird email addresses and report + any errors. +- Open a PR to add new server information into `domains.csv` so their users can + more easily use mutt-wizard. - If nothing else, [Donate!](https://paypal.me/LukeMSmith) -See Luke's website [here](https://lukesmith.xyz). Email him at [luke@lukesmith.xyz](mailto:luke@lukesmith.xyz). +See Luke's website [here](https://lukesmith.xyz). Email him at +[luke@lukesmith.xyz](mailto:luke@lukesmith.xyz). mutt-wizard is free/libre software, licensed under the GPLv3. ## Details for Tinkerers - The critical `mutt`/`neomutt` files are in `~/.config/mutt/`. -- Put whatever global settings you want in `muttrc`. mutt-wizard will add some lines to this file which you shouldn't remove unless you know what you're doing, but you can move them up/down over your personal config lines if you need to. If you get binding conflict errors in mutt, you might need to do this. -- Each of the accounts that mutt-wizard generates will have custom settings set in a separate file in `accounts/`. You can edit these freely if you want to tinker with settings specific to an account. -- In `/usr/share/mutt-wizard` are several global config files, including `mutt-wizard`'s default settings. You can overwride this in your `muttrc` if you wish. +- Put whatever global settings you want in `muttrc`. mutt-wizard will add some + lines to this file which you shouldn't remove unless you know what you're + doing, but you can move them up/down over your personal config lines if you + need to. If you get binding conflict errors in mutt, you might need to do + this. +- Each of the accounts that mutt-wizard generates will have custom settings set + in a separate file in `accounts/`. You can edit these freely if you want to + tinker with settings specific to an account. +- In `/usr/share/mutt-wizard` are several global config files, including + `mutt-wizard`'s default settings. You can overwride this in your `muttrc` if + you wish. ## Watch out for these things: -- Gmail accounts can now create 'App Password' to use with """less secure""" applications. This password is single use (ie. for setup) and will be stored and encrypted locally. Enabling third-party applications requires turning off two-factor authentication and this will circumvent that. You might also need to manually "Enable IMAP" in the settings. -- Protonmail accounts will require you to set up "Protonmail Bridge" to access PM's IMAP and SMTP servers. Configure that before running mutt-wizard. Note that when mutt-wizard asks for a password, you should put in your [bridge password](https://protonmail.com/bridge/thunderbird#3), not your account password. -- Protonmail bridge is prone to timing out. Watch out for this while adding an account. If the bridge times out, try again. It might help to [increase the timeout](https://protonmail.com/support/knowledge-base/thunderbird-connection-server-timed-error/) in your `mbsyncrc`. -- 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. - - `isync` is not fully UTF-8 compatible, so non-Latin characters may be garbled (although sync should succeed). `mw` will also not autocreate mailbox shortcuts since it is looking for English mailbox names. I strongly recommend you to set your email language to English on your mail server to avoid these problems. + +### Gmail + +Gmail accounts should require an +[application password](https://support.google.com/accounts/answer/185833) to +work unless you allow Gmail to access "less secure" applications. You may also +need to "Enable IMAP" in your Gmail settings. + +### Protonmail + +Protonmail accounts will require you to set up "Protonmail Bridge" to access +PM's IMAP and SMTP servers. Configure that before running mutt-wizard. Note +that when mutt-wizard asks for a password, you should put in your +[bridge password](https://protonmail.com/bridge/thunderbird#3), not your +account password. + +Protonmail bridge is prone to timing out. Watch out for this while adding an +account. If the bridge times out, try again. It might help to +[increase the timeout](https://protonmail.com/support/knowledge-base/thunderbird-connection-server-timed-error/) +in your `mbsyncrc`. + +### Other + +- 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. + - `isync` is not fully UTF-8 compatible, so non-Latin characters may be + garbled (although sync should succeed). `mw` will also not autocreate + mailbox shortcuts since it is looking for English mailbox names. I strongly + recommend you to set your email language to English on your mail server to + avoid these problems. ## To-do diff --git a/bin/mailsync b/bin/mailsync new file mode 100755 index 0000000..02e4f98 --- /dev/null +++ b/bin/mailsync @@ -0,0 +1,98 @@ +#!/bin/sh + +# - Syncs mail for all accounts, or a single account given as an argument. +# - Displays a notification showing the number of new mails. +# - Displays a notification for each new mail with its subject displayed. +# - Runs notmuch to index new mail. +# - This script can be set up as a cron job for automated mail syncing. + +# There are many arbitrary and ugly features in this script because it is +# inherently difficult to pass environmental variables to cronjobs and other +# issues. It also should at least be compatible with Linux (and maybe BSD) with +# Xorg and MacOS as well. + +# Run only if user logged in (prevent cron errors) +pgrep -u "${USER:=$LOGNAME}" >/dev/null || { echo "$USER not logged in; sync will not run."; exit ;} +# Run only if not already running in other instance +pgrep -x mbsync >/dev/null && { echo "mbsync is already running." ; exit ;} + +# First, we have to get the right variables for the mbsync file, the pass +# archive, notmuch and the GPG home. This is done by searching common profile +# files for variable assignments. This is ugly, but there are few options that +# will work on the maximum number of machines. +eval `grep -h -- \ + "^\(export \)\?\(MBSYNCRC\|PASSWORD_STORE_DIR\|NOTMUCH_CONFIG\|GNUPGHOME\)=" \ + "$HOME/.profile" "$HOME/.bash_profile" "$HOME/.zprofile" "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.pam_environment" 2>/dev/null` +# One alternative to this kind of command would be marking the script for +# /bin/sh -l. That might cause other problems on other particular setups that +# do more complicated things on login, or those people who assign environmental +# variables in shell rc files. + +# This variable might be required for soysdemd users, but it will break the +# script on Artix runit. +# export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus +export GPG_TTY=$TTY + +[ -n "$MBSYNCRC" ] && alias mbsync="mbsync -c $MBSYNCRC" || MBSYNCRC="$HOME/.mbsyncrc" + +# Settings are different for MacOS (Darwin) systems. +case "$(uname)" in + Darwin) + notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $account\"" && sleep 2 ;} + messageinfo() { osascript -e "display notification with title \"📧 $from\" subtitle \"$subject\"" ;} + ;; + *) + displays="$(ps axo user,cmd | grep "^$USER\s\+.*Xorg" | grep -wo "[0-9]*:[0-9]\+")" + notify() { for x in $displays; do + export DISPLAY=$x + notify-send --app-name="mutt-wizard" "mutt-wizard" "📬 $2 new mail(s) in \`$1\` account." + done ;} + messageinfo() { for x in $displays; do + export DISPLAY=$x + notify-send --app-name="mutt-wizard" "📧$from:" "$subject" + done ;} + ;; +esac + +# Check account for new mail. Notify if there is new content. +syncandnotify() { + acc="$(echo "$account" | sed "s/.*\///")" + if [ -z "$opts" ]; then mbsync "$acc"; else mbsync "$opts" "$acc"; fi + new=$(find "$HOME/.local/share/mail/$acc/INBOX/new/" "$HOME/.local/share/mail/$acc/Inbox/new/" "$HOME/.local/share/mail/$acc/inbox/new/" -type f -newer "$HOME/.config/mutt/.mailsynclastrun" 2> /dev/null) + newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l) + if [ "$newcount" -gt "0" ]; then + notify "$acc" "$newcount" & + for file in $new; do + # Extract subject and sender from mail. + from=$(awk '/^From: / && ++n ==1,/^\<.*\>:/' "$file" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | awk '{ $1=""; if (NF>=3)$NF=""; print $0 }' | sed 's/^[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//') + subject=$(awk '/^Subject: / && ++n == 1,/^\<.*\>: / && ++i == 2' "$file" | head -n 1 | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | sed 's/^Subject: //' | sed 's/^{[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//' | tr -d '\n') + messageinfo & + done + fi +} + +# Sync accounts passed as argument or all. +if [ "$#" -eq "0" ]; then + accounts="$(awk '/^Channel/ {print $2}' "$MBSYNCRC")" +else + for arg in "$@"; do + [ "${arg%${arg#?}}" = '-' ] && opts="${opts:+${opts} }${arg}" && shift 1 + done + accounts=$* +fi + +#( kill -46 "$(pidof "${STATUSBAR:-dwmblocks}")" >/dev/null 2>&1 ) 2>/dev/null + +# Parallelize multiple accounts +for account in $accounts +do + syncandnotify & +done + +wait +#( kill -46 "$(pidof "${STATUSBAR:-dwmblocks}")" >/dev/null 2>&1 ) 2>/dev/null + +notmuch new 2>/dev/null + +#Create a touch file that indicates the time of the last run of mailsync +touch "$HOME/.config/mutt/.mailsynclastrun" diff --git a/bin/mw b/bin/mw index a207d4e..f713761 100755 --- a/bin/mw +++ b/bin/mw @@ -21,7 +21,7 @@ cachedir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard" muttrc="$muttdir/muttrc" msmtprc="${XDG_CONFIG_HOME:-$HOME/.config}/msmtp/config" msmtplog="${XDG_CONFIG_HOME:-$HOME/.config}/msmtp/msmtp.log" -MARKER="# mw-autogenerated" +marker="# mw-autogenerated" alias mbsync='mbsync -c "$mbsyncrc"' for x in "/etc/ssl/certs/ca-certificates.crt" "/etc/pki/tls/certs/ca-bundle.crt" "/etc/ssl/ca-bundle.pem" "/etc/pki/tls/cacert.pem" "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem" "/etc/ssl/cert.pem" "/usr/local/share/ca-certificates/" @@ -151,7 +151,7 @@ delete() { if [ -z "${fulladdr+x}" ]; then [ -z "$fulladdr" ] && echo "Invalid account name given." && return 1 - sed -ibu "/IMAPStore $fulladdr-remote$/,/# End profile/d" "$mbsyncrc" ; rm -rf "$mbsyncrc"bu + sed -ibu "/IMAPStore $fulladdr-remote$/,/# End profile/d" "$mbsyncrc" ; rm -f "$mbsyncrc"bu rm -rf "${cachedir:?}/${fulladdr:?}" "$accdir/"[1-9]"-$fulladdr.muttrc" sed -ibu "/[0-9]-$fulladdr.muttrc/d" "$muttrc" ; rm -f "$muttrc"bu sed -ibu "/account $fulladdr/,/^\(\s*$\|account\)/d" "$msmtprc"; rm -f "$msmtprc"bu @@ -205,9 +205,9 @@ writeinfo() { mkdir -p "$muttdir" "$accdir" "$cachedir/$fulladdr/bodies" "${XDG_ # Create a muttrc for viewing mail. echo "$mutt_profile" > "$accdir/$idnum-$fulladdr.muttrc" [ ! -f "$muttrc" ] && echo "# vim: filetype=neomuttrc" > "$muttrc" - ! grep -q "^source.*mutt-wizard.muttrc" "$muttrc" && echo "source $mwconfig $MARKER" >> "$muttrc" - ! grep "^source.*.muttrc" "$muttrc" | grep -qv "$mwconfig" && echo "source $accdir/$idnum-$fulladdr.muttrc $MARKER" >> "$muttrc" - echo "macro index,pager i$idnum 'source $accdir/$idnum-$fulladdr.muttrc!;' \"switch to $fulladdr\" $MARKER" >> "$muttrc" + ! grep -q "^source.*mutt-wizard.muttrc" "$muttrc" && echo "source $mwconfig $marker" >> "$muttrc" + ! grep "^source.*.muttrc" "$muttrc" | grep -qv "$mwconfig" && echo "source $accdir/$idnum-$fulladdr.muttrc $marker" >> "$muttrc" + echo "macro index,pager i$idnum 'source $accdir/$idnum-$fulladdr.muttrc!;' \"switch to $fulladdr\" $marker" >> "$muttrc" notmuchauto # Create a notmuch config file if not present already. } @@ -216,12 +216,12 @@ getpass() { while : ; do pass rm -f "$pass_prefix$fulladdr" >/dev/null 2>&1 pass insert "$pass_prefix$fulladdr" && break; done ;} formatShortcut() { toappend="$toappend -macro index,pager g$1 \"=$3\" \"go to $2\" $MARKER -macro index,pager M$1 \";=$3\" \"move mail to $2\" $MARKER -macro index,pager C$1 \";=$3\" \"copy mail to $2\" $MARKER" >> "$accdir/$idnum-$fulladdr.muttrc" ;} +macro index,pager g$1 \"=$3\" \"go to $2\" $marker +macro index,pager M$1 \";=$3\" \"move mail to $2\" $marker +macro index,pager C$1 \";=$3\" \"copy mail to $2\" $marker" >> "$accdir/$idnum-$fulladdr.muttrc" ;} setBox() { toappend="$toappend -set $1 = \"+$2\" $MARKER" ;} +set $1 = \"+$2\" $marker" ;} getboxes() { [ -n "${force+x}" ] && mailboxes="INBOX Drafts @@ -239,7 +239,7 @@ Archive" && return 0 fi ;} finalize() { echo "$mailboxes" | xargs -I {} mkdir -p "$maildir/$fulladdr/{}/cur" "$maildir/$fulladdr/{}/tmp" "$maildir/$fulladdr/{}/new" - sed -ibu "/$MARKER/d" "$accdir/$idnum-$fulladdr.muttrc" ; rm -f "$accdir/$idnum-$fulladdr.muttrcbu" + sed -ibu "/$marker/d" "$accdir/$idnum-$fulladdr.muttrc" ; rm -f "$accdir/$idnum-$fulladdr.muttrcbu" toappend="mailboxes $(echo "$mailboxes" | sed "s/^/\"=/;s/$/\"/" | paste -sd ' ' - )" for x in $mailboxes; do case "$x" in @@ -257,12 +257,6 @@ finalize() { echo "$mailboxes" | xargs -I {} mkdir -p "$maildir/$fulladdr/{}/cur command -V urlview >/dev/null 2>&1 && [ ! -f "$HOME/.urlview" ] && echo "COMMAND \$BROWSER" > "$HOME/.urlview" return 0 ;} -syncwrapper() { mbsync "${1:--a}" & - ( kill -46 "$(pidof "${STATUSBAR:-dwmblocks}")" >/dev/null 2>&1 ) 2>/dev/null - wait - ( kill -46 "$(pidof "${STATUSBAR:-dwmblocks}")" >/dev/null 2>&1 ) 2>/dev/null - notmuch new ;} - notmuchauto() { \ [ -z "$NOTMUCH_CONFIG" ] && NOTMUCH_CONFIG="$HOME/.notmuch-config" [ -f "$NOTMUCH_CONFIG" ] && return 0 @@ -282,6 +276,17 @@ synchronize_flags=true gpg_path=$GPG" echo "$nmbasic" > "$NOTMUCH_CONFIG" ;} +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 + else + echo "Adding automatic mailsync every ${cronmin:-10} minutes..." + echo "*/${cronmin-10} * * * * /usr/local/bin/mailsync" >> "$cron" + fi && + 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." @@ -292,7 +297,7 @@ setact() { if [ -n "${action+x}" ] && [ "$action" != "$1" ]; then trap 'echo -e "\033[0m\n"; exit' INT ABRT -while getopts "fplhodYD:y:i:I:s:S:u:a:n:x:m:" o; do case "${o}" in +while getopts "fplhodTYD:y:i:I:s:S:u:a:n:x:m:t:" o; do case "${o}" in l) setact list || exit 1 ;; d) setact delete || exit 1 ;; D) setact delete || exit 1 ; fulladdr="$OPTARG" ;; @@ -309,6 +314,8 @@ while getopts "fplhodYD:y:i:I:s:S:u:a:n:x:m:" o; do case "${o}" in o) setact add || exit 1 ; online=True ;; f) setact add || exit 1 ; force=True ;; x) setact add || exit 1 ; password="$OPTARG" ;; + t) setact toggle || exit 1 ; cronmin="$OPTARG" ;; + T) setact toggle || exit 1 ;; p) echo "NOTE: Protonmail users must install and configure Protonmail Bridge first for the first sync to work." imap="127.0.0.1" iport="1143" @@ -329,6 +336,8 @@ Main actions: -D your@email.com Force remove account without confirmation -y your@email.com Sync mail for account by name -Y Sync mail for all accounts + -t number Toggle automatic mailsync every minutes + -T Toggle automatic mailsync Options allowed with -a: -u Account login name if not full address @@ -357,5 +366,6 @@ case "$action" in list) list ;; add) askinfo && getprofiles && writeinfo && getboxes && finalize || { delete ; exit 1 ;} ;; delete) delete $fulladdr ;; - sync) syncwrapper $fulladdr ;; + sync) mailsync $fulladdr ;; + toggle) togglecron ;; esac diff --git a/mw.1 b/mw.1 index 3ed4d95..920e513 100644 --- a/mw.1 +++ b/mw.1 @@ -35,6 +35,12 @@ download and upload mail for an email account .TP .B -Y sync all email accounts +.TP +.B -t 15 +toggle a cronjob that syncs your mail every 15 minutes (or any other number under 60) +.TP +.B -T +toggle a cronjob without specifying minutes between sync .SH OPTIONS FOR ADDING ACCOUNTS These can be specified on the command line, otherwise, you will be prompted for what is necessary. mutt-wizard knows the IMAP/SMTP server information for most email providers, so specifying them is usually redundant. .TP @@ -75,6 +81,13 @@ connection will still be attempted in setup to discover mailboxes. Add a Protonmail account. Protonmail Bridge must be installed and set up. .SH DETAILS .TP +.B mailsync +mutt-wizard calls a script +.I mailsync +to sync mail. This script additionally indexes new mail with notmuch and gives you a notification if new mail has arrived. If you want to bypass its additional features, you can always just run +.I mbsync -a +to sync your mail directly. +.TP .B Mail location If the user chooses to keep offline email with .B isync, From aa4fb999ebbe6e99ac5e083be372b3630354c8bc Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 1 Jan 2021 08:11:14 -0500 Subject: [PATCH 079/225] systemd fix, check for variables with whitespace --- bin/mailsync | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/mailsync b/bin/mailsync index 02e4f98..1d676b8 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -20,17 +20,17 @@ pgrep -x mbsync >/dev/null && { echo "mbsync is already running." ; exit ;} # archive, notmuch and the GPG home. This is done by searching common profile # files for variable assignments. This is ugly, but there are few options that # will work on the maximum number of machines. -eval `grep -h -- \ - "^\(export \)\?\(MBSYNCRC\|PASSWORD_STORE_DIR\|NOTMUCH_CONFIG\|GNUPGHOME\)=" \ - "$HOME/.profile" "$HOME/.bash_profile" "$HOME/.zprofile" "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.pam_environment" 2>/dev/null` +eval "$(grep -h -- \ + "^\s*\(export \)\?\(MBSYNCRC\|PASSWORD_STORE_DIR\|NOTMUCH_CONFIG\|GNUPGHOME\)=" \ + "$HOME/.profile" "$HOME/.bash_profile" "$HOME/.zprofile" "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.pam_environment" 2>/dev/null)" # One alternative to this kind of command would be marking the script for # /bin/sh -l. That might cause other problems on other particular setups that # do more complicated things on login, or those people who assign environmental # variables in shell rc files. -# This variable might be required for soysdemd users, but it will break the -# script on Artix runit. -# export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus +case "$(readlink -f /sbin/init)" in + *systemd*) export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus ;; +esac export GPG_TTY=$TTY [ -n "$MBSYNCRC" ] && alias mbsync="mbsync -c $MBSYNCRC" || MBSYNCRC="$HOME/.mbsyncrc" From 22acbeb3e5146ae9d04398169b4fb4aa57587804 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 1 Jan 2021 13:32:41 -0500 Subject: [PATCH 080/225] makefile fix --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1d8d362..7b78355 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ install: uninstall: for script in bin/*; do \ - rm -f $(DESTDIR)$(PREFIX)/bin/$$script; \ + rm -f $(DESTDIR)$(PREFIX)/$$script; \ done rm -rf $(DESTDIR)$(PREFIX)/share/mutt-wizard rm -f $(DESTDIR)$(MANPREFIX)/man1/mw.1 From 63466ad954d5763faa18039fe42ace56af03ce4c Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sat, 2 Jan 2021 10:18:41 -0500 Subject: [PATCH 081/225] imap ssl off when unencrypted port given --- bin/mw | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/mw b/bin/mw index f713761..f54934c 100755 --- a/bin/mw +++ b/bin/mw @@ -35,6 +35,7 @@ list() { getaccounts && [ -n "$accounts" ] && echo "$accounts" ;} getprofiles() { \ unset msmtp_header msmtp_profile mutt_profile mbsync_profile + [ "$iport" = "1143" ] && imapssl="None" msmtp_header="defaults auth on tls on @@ -55,7 +56,7 @@ Port ${iport:-993} User $login PassCmd \"pass $pass_prefix$fulladdr\" AuthMechs LOGIN -SSLType ${ssltype:-IMAPS} +SSLType ${imapssl:-IMAPS} CertificateFile $sslcert MaildirStore $fulladdr-local @@ -283,7 +284,7 @@ togglecron() { cron="$(mktemp)" sed -ibu /mailsync/d "$cron"; rm -f "$cron"bu else echo "Adding automatic mailsync every ${cronmin:-10} minutes..." - echo "*/${cronmin-10} * * * * /usr/local/bin/mailsync" >> "$cron" + echo "*/${cronmin-10} * * * * $prefix/bin/mailsync" >> "$cron" fi && crontab "$cron"; rm -f "$cron" ;} @@ -321,7 +322,6 @@ while getopts "fplhodTYD:y:i:I:s:S:u:a:n:x:m:t:" o; do case "${o}" in iport="1143" smtp="127.0.0.1" sport="1025" - ssltype="None" tlsline="tls_fingerprint $(msmtp --serverinfo --host=$smtp --port=$sport --tls --tls-certcheck=off | awk '/SHA256:/ {print $2}')" setact add || exit 1 ;; From 4dbf70e40355b73b16a3b0b010960a0d1a681740 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Wed, 6 Jan 2021 09:17:59 -0500 Subject: [PATCH 082/225] less gimicky feedback --- bin/mw | 12 +++++------- share/domains.csv | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/bin/mw b/bin/mw index f54934c..3586df7 100755 --- a/bin/mw +++ b/bin/mw @@ -3,7 +3,7 @@ command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2" [ -z ${PASSWORD_STORE_DIR+x} ] && PASSWORD_STORE_DIR="$HOME/.password-store" [ -r "$PASSWORD_STORE_DIR/.gpg-id" ] && - "$GPG" --list-secret-keys $(cat "$PASSWORD_STORE_DIR/.gpg-id") >/dev/null 2>&1 || { + "$GPG" --list-secret-keys "$(cat "$PASSWORD_STORE_DIR/.gpg-id")" >/dev/null 2>&1 || { printf "\`pass\` must be installed and initialized to encrypt passwords.\\nBe sure it is installed and run \`pass init \`.\\nIf you don't have a GPG public private key pair, run \`%s --full-gen-key\` first.\\n" "$GPG" exit 1 } @@ -235,7 +235,7 @@ Archive" && return 0 return 0 else echo "$mailboxes" - printf "\033[31m\033[31mLog-on not successful.\033[0m\\nIt seems that either you inputted the wrong password or server settings, or there are other requirements for your account out of the control of mutt-wizard.\\n" + echo "Log-on not successful." return 1 fi ;} @@ -254,7 +254,7 @@ finalize() { echo "$mailboxes" | xargs -I {} mkdir -p "$maildir/$fulladdr/{}/cur esac done echo "$toappend" >> "$accdir/$idnum-$fulladdr.muttrc" - [ -z "${online+x}" ] && printf "\033[33mYou should now be able to run \`\033[32mmw -y %s\033[33m\` to begin to download your mail.\033[0m\\n" "$fulladdr" + [ -z "${online+x}" ] && echo "$fulladdr (account #$idnum) added successfully." command -V urlview >/dev/null 2>&1 && [ ! -f "$HOME/.urlview" ] && echo "COMMAND \$BROWSER" > "$HOME/.urlview" return 0 ;} @@ -296,8 +296,6 @@ setact() { if [ -n "${action+x}" ] && [ "$action" != "$1" ]; then action="$1" fi; } -trap 'echo -e "\033[0m\n"; exit' INT ABRT - while getopts "fplhodTYD:y:i:I:s:S:u:a:n:x:m:t:" o; do case "${o}" in l) setact list || exit 1 ;; d) setact delete || exit 1 ;; @@ -360,12 +358,12 @@ exit 1 ;; esac done -! command -v mbsync >/dev/null && [ -z "${force+x}" ] && printf "\`mbsync (isync package)\` must be installed to run mutt-wizard.\\n" && exit 1 +! command -v mbsync >/dev/null && [ -z "${force+x}" ] && echo "\`mbsync (isync package)\` must be installed." && exit 1 case "$action" in list) list ;; add) askinfo && getprofiles && writeinfo && getboxes && finalize || { delete ; exit 1 ;} ;; - delete) delete $fulladdr ;; + delete) delete ;; sync) mailsync $fulladdr ;; toggle) togglecron ;; esac diff --git a/share/domains.csv b/share/domains.csv index 64dcf80..50ce1ff 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -1,8 +1,8 @@ +ADDRESS,IMAP,imap port,SMTP,smtp port 126.com,imap.126.com,993,smtp.126.com,587 163.com,imap.163.com,993,smtp.163.com,587 420blaze.it,mail.cock.li,993,mail.cock.li,587 8chan.co,mail.cock.li,993,mail.cock.li,587 -ADDRESS,IMAP,imap port,SMTP,smtp port aaathats3as.com,mail.cock.li,993,mail.cock.li,587 accountant.com,imap.mail.com,993,smtp.mail.com,587 activist.com,imap.mail.com,993,smtp.mail.com,587 From ca9f1a12ccbc01889fd2a1257462594e4d2ea272 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Wed, 6 Jan 2021 21:13:48 -0500 Subject: [PATCH 083/225] use curl to login rm mbsync requirement for online storage --- README.md | 5 +++-- bin/mw | 17 ++++++----------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index fc6999a..46c4a36 100644 --- a/README.md +++ b/README.md @@ -66,9 +66,10 @@ The mutt-wizard is run with the command `mw`. Once everything is setup, you'll u ## Dependencies - `neomutt` - the email client. -- `isync` - downloads and syncs the mail. (required at install) +- `curl` - tests connections (required at install). +- `isync` - downloads and syncs the mail (required if storing IMAP mail locally). - `msmtp` - sends the email. -- `pass` - safely encrypts passwords (required at install) +- `pass` - safely encrypts passwords (required at install). 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 recent version manually or manually remove the offending lines in the config in `/usr/share/mutt-wizard/mutt-wizard.muttrc`. diff --git a/bin/mw b/bin/mw index 3586df7..f009e90 100755 --- a/bin/mw +++ b/bin/mw @@ -199,9 +199,8 @@ writeinfo() { mkdir -p "$muttdir" "$accdir" "$cachedir/$fulladdr/bodies" "${XDG_ # On Ubuntu/Debian, a link is needed since they use an older version. command -V apt-get >/dev/null 2>&1 && ln -s "$msmtprc" "$HOME/.msmtprc" 2>/dev/null - # Create the mbsync config file. - mkdir -p "${mbsyncrc%/*}" - echo "$mbsync_profile" >> "$mbsyncrc" + # Create the mbsync config file if local account. + [ -z "${online+x}" ] && mkdir -p "${mbsyncrc%/*}" && echo "$mbsync_profile" >> "$mbsyncrc" # Create a muttrc for viewing mail. echo "$mutt_profile" > "$accdir/$idnum-$fulladdr.muttrc" @@ -230,14 +229,10 @@ Junk Trash Sent Archive" && return 0 - if mailboxes="$(mbsync -l "$fulladdr" | sed 's/\//./')" >/dev/null 2>&1 && [ -n "$mailboxes" ]; then - [ -n "${online+x}" ] && sed -ibu "/IMAPStore $fulladdr-remote$/,/# End profile/d" "$mbsyncrc" ; rm -f "$mbsyncrc"bu - return 0 - else - echo "$mailboxes" - echo "Log-on not successful." - return 1 - fi ;} + info="$(curl -s --user "$login:$(pass $pass_prefix$fulladdr)" --url "${protocol:-imaps}://$imap")" || + { echo "Log-on not successful." ; exit 1 ;} + mailboxes="$(echo "$info" | sed "s/.*\" //" | tr -d ' ')" +} finalize() { echo "$mailboxes" | xargs -I {} mkdir -p "$maildir/$fulladdr/{}/cur" "$maildir/$fulladdr/{}/tmp" "$maildir/$fulladdr/{}/new" sed -ibu "/$marker/d" "$accdir/$idnum-$fulladdr.muttrc" ; rm -f "$accdir/$idnum-$fulladdr.muttrcbu" From 78030885b4e3153b69d408424beeb544adc093a8 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Wed, 6 Jan 2021 21:25:09 -0500 Subject: [PATCH 084/225] fix --- bin/mw | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/mw b/bin/mw index f009e90..e2d8f41 100755 --- a/bin/mw +++ b/bin/mw @@ -229,8 +229,8 @@ Junk Trash Sent Archive" && return 0 - info="$(curl -s --user "$login:$(pass $pass_prefix$fulladdr)" --url "${protocol:-imaps}://$imap")" || - { echo "Log-on not successful." ; exit 1 ;} + info="$(curl -s --user "$login:$(pass $pass_prefix$fulladdr)" --url "${protocol:-imaps}://$imap")" + [ -z "$info" ] && echo "Log-on not successful." && return 1 mailboxes="$(echo "$info" | sed "s/.*\" //" | tr -d ' ')" } From f83c45689b21fccb917fdb4c555280eaf19ef78f Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Wed, 6 Jan 2021 21:34:00 -0500 Subject: [PATCH 085/225] temporary soydevery --- bin/mw | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/mw b/bin/mw index e2d8f41..9950fae 100755 --- a/bin/mw +++ b/bin/mw @@ -157,6 +157,12 @@ delete() { if [ -z "${fulladdr+x}" ]; then sed -ibu "/[0-9]-$fulladdr.muttrc/d" "$muttrc" ; rm -f "$muttrc"bu sed -ibu "/account $fulladdr/,/^\(\s*$\|account\)/d" "$msmtprc"; rm -f "$msmtprc"bu pass rm -f "$pass_prefix$fulladdr" >/dev/null 2>&1 + + # Get rid of those multiple newlines because I don't know awk well enough to do it by default lol. + for file in "$msmtprc" "$mbsyncrc"; do + tr '\n' '|' < "$file" | sed "s/||\+/||/g" | tr '|' '\n' >> "$file"bu + mv -f "$file"bu "$file" + done } askinfo() { \ From 16de5dc350d06cd45338271a2286c0629ef20435 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Wed, 6 Jan 2021 21:38:25 -0500 Subject: [PATCH 086/225] don't ask realname if not given; assume userid --- README.md | 2 +- bin/mw | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 46c4a36..a68e298 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ The mutt-wizard is run with the command `mw`. Once everything is setup, you'll u #### Providing arguments - `-u` -- Give an account username if different from the email address. -- `-n` -- A real name to be used by the account. Put in quotations if multiple words +- `-n` -- A real name to be used by the account. Put in quotations if multiple words. - `-i` -- IMAP server address - `-I` -- IMAP server port (otherwise assumed to be 993) - `-s` -- SMTP server address diff --git a/bin/mw b/bin/mw index 9950fae..0c00e53 100755 --- a/bin/mw +++ b/bin/mw @@ -180,8 +180,7 @@ askinfo() { \ [ -z "$smtp" ] && echo "Give your email server's SMTP address (excluding the port number):" && read -r smtp [ "$sport" = 465 ] && tlsline="tls_starttls off" - [ -z "$realname" ] && echo "Give the name you would like to be identified by on the email account:" && - read -r realname + [ -z "$realname" ] && realname="${fulladdr%%@*}" login="${login:-$fulladdr}" if [ -n "${password+x}" ]; then createpass From 564c529f8ec3aa6697d966dde89abdf132012240 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 7 Jan 2021 17:04:08 -0500 Subject: [PATCH 087/225] curl redirects and times out --- bin/mailsync | 6 +----- bin/mw | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/bin/mailsync b/bin/mailsync index 1d676b8..3fac7c5 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -81,16 +81,12 @@ else accounts=$* fi -#( kill -46 "$(pidof "${STATUSBAR:-dwmblocks}")" >/dev/null 2>&1 ) 2>/dev/null - # Parallelize multiple accounts -for account in $accounts -do +for account in $accounts; do syncandnotify & done wait -#( kill -46 "$(pidof "${STATUSBAR:-dwmblocks}")" >/dev/null 2>&1 ) 2>/dev/null notmuch new 2>/dev/null diff --git a/bin/mw b/bin/mw index 0c00e53..19befb3 100755 --- a/bin/mw +++ b/bin/mw @@ -234,7 +234,7 @@ Junk Trash Sent Archive" && return 0 - info="$(curl -s --user "$login:$(pass $pass_prefix$fulladdr)" --url "${protocol:-imaps}://$imap")" + info="$(curl --location-trusted -s -m 5 --user "$login:$(pass $pass_prefix$fulladdr)" --url "${protocol:-imaps}://$imap")" [ -z "$info" ] && echo "Log-on not successful." && return 1 mailboxes="$(echo "$info" | sed "s/.*\" //" | tr -d ' ')" } From c8f2aa2c529464306decbc2e21f1702d4bd9ae17 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 7 Jan 2021 17:38:40 -0500 Subject: [PATCH 088/225] close #566 --- 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 a9484f3..2cb7c8e 100644 --- a/share/mutt-wizard.muttrc +++ b/share/mutt-wizard.muttrc @@ -3,7 +3,7 @@ # mutt-wizard will have this file sourced from your muttrc. # In the interest of seamless updating, do not edit this file. # If you want to override any settings, set those in your muttrc. -set mailcap_path = /usr/local/share/mutt-wizard/mailcap +set mailcap_path = /usr/local/share/mutt-wizard/mailcap:$mailcap_path set mime_type_query_command = "file --mime-type -b %s" set date_format="%y/%m/%d %I:%M%p" set index_format="%2C %Z %?X?A& ? %D %-15.15F %s (%-4.4c)" From 038b90bb46115c5696fdaee6fd05394ca14e7736 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 7 Jan 2021 18:11:35 -0500 Subject: [PATCH 089/225] tweaks cloe #367 --- bin/mw | 90 ++++++++++++++++++++++++++++++---------------------------- 1 file changed, 46 insertions(+), 44 deletions(-) diff --git a/bin/mw b/bin/mw index 19befb3..a2ad6bd 100755 --- a/bin/mw +++ b/bin/mw @@ -1,13 +1,5 @@ #!/bin/sh -command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2" -[ -z ${PASSWORD_STORE_DIR+x} ] && PASSWORD_STORE_DIR="$HOME/.password-store" -[ -r "$PASSWORD_STORE_DIR/.gpg-id" ] && - "$GPG" --list-secret-keys "$(cat "$PASSWORD_STORE_DIR/.gpg-id")" >/dev/null 2>&1 || { - printf "\`pass\` must be installed and initialized to encrypt passwords.\\nBe sure it is installed and run \`pass init \`.\\nIf you don't have a GPG public private key pair, run \`%s --full-gen-key\` first.\\n" "$GPG" - exit 1 - } - prefix="/usr/local" pass_prefix="mw-" muttdir="${XDG_CONFIG_HOME:-$HOME/.config}/mutt" # Main mutt config location @@ -24,18 +16,28 @@ msmtplog="${XDG_CONFIG_HOME:-$HOME/.config}/msmtp/msmtp.log" marker="# mw-autogenerated" alias mbsync='mbsync -c "$mbsyncrc"' -for x in "/etc/ssl/certs/ca-certificates.crt" "/etc/pki/tls/certs/ca-bundle.crt" "/etc/ssl/ca-bundle.pem" "/etc/pki/tls/cacert.pem" "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem" "/etc/ssl/cert.pem" "/usr/local/share/ca-certificates/" -do +for x in "/etc/ssl/certs/ca-certificates.crt" "/etc/pki/tls/certs/ca-bundle.crt" "/etc/ssl/ca-bundle.pem" "/etc/pki/tls/cacert.pem" "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem" "/etc/ssl/cert.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 ;} +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" ] && + "$GPG" --list-secret-keys "$(cat "$PASSWORD_STORE_DIR/.gpg-id")" >/dev/null 2>&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 --fullgenkey\`.)" + exit 1 ;} ;} + getaccounts() { accounts="$(find -L "$accdir" -type f | grep -o "[0-9]-.*.muttrc" | sed "s/-/: /;s/\.muttrc$//" | sort -n)" ;} list() { getaccounts && [ -n "$accounts" ] && echo "$accounts" ;} getprofiles() { \ unset msmtp_header msmtp_profile mutt_profile mbsync_profile - [ "$iport" = "1143" ] && imapssl="None" + case "$iport" in + 1143) imapssl=None ;; + 143) imapssl=STARTTLS ;; + esac msmtp_header="defaults auth on tls on @@ -296,34 +298,7 @@ setact() { if [ -n "${action+x}" ] && [ "$action" != "$1" ]; then action="$1" fi; } -while getopts "fplhodTYD:y:i:I:s:S:u:a:n:x:m:t:" o; do case "${o}" in - l) setact list || exit 1 ;; - d) setact delete || exit 1 ;; - D) setact delete || exit 1 ; fulladdr="$OPTARG" ;; - y) setact sync || exit 1 ; fulladdr="$OPTARG" ;; - Y) setact sync || exit 1 ;; - a) setact add || exit 1 ; fulladdr="$OPTARG" ;; - i) setact add || exit 1 ; imap="$OPTARG" ;; - I) setact add || exit 1 ; iport="$OPTARG" ;; - s) setact add || exit 1 ; smtp="$OPTARG" ;; - S) setact add || exit 1 ; sport="$OPTARG" ;; - u) setact add || exit 1 ; login="$OPTARG" ;; - n) setact add || exit 1 ; realname="$OPTARG" ;; - m) setact add || exit 1 ; maxmes="$OPTARG" ;; - o) setact add || exit 1 ; online=True ;; - f) setact add || exit 1 ; force=True ;; - x) setact add || exit 1 ; password="$OPTARG" ;; - t) setact toggle || exit 1 ; cronmin="$OPTARG" ;; - T) setact toggle || exit 1 ;; - p) echo "NOTE: Protonmail users must install and configure Protonmail Bridge first for the first sync to work." - imap="127.0.0.1" - iport="1143" - smtp="127.0.0.1" - sport="1025" - tlsline="tls_fingerprint $(msmtp --serverinfo --host=$smtp --port=$sport --tls --tls-certcheck=off | awk '/SHA256:/ {print $2}')" - setact add || exit 1 - ;; - *) cat << EOF +mwinfo() { cat << EOF mw: mutt-wizard, auto-configure email accounts for mutt including downloadable mail with \`isync\`. @@ -354,16 +329,43 @@ NOTE: Once at least one account is added, you can run To change an account's password, run \`pass edit ${pass_prefix}your@email.com\`. EOF -exit 1 -;; -esac done +} -! command -v mbsync >/dev/null && [ -z "${force+x}" ] && echo "\`mbsync (isync package)\` must be installed." && exit 1 +while getopts "fplhodTYD:y:i:I:s:S:u:a:n:x:m:t:" o; do case "${o}" in + l) setact list || exit 1 ;; + d) setact delete || exit 1 ;; + D) setact delete || exit 1 ; fulladdr="$OPTARG" ;; + y) setact sync || exit 1 ; fulladdr="$OPTARG" ;; + Y) setact sync || exit 1 ;; + a) setact add || exit 1 ; fulladdr="$OPTARG" ;; + i) setact add || exit 1 ; imap="$OPTARG" ;; + I) setact add || exit 1 ; iport="$OPTARG" ;; + s) setact add || exit 1 ; smtp="$OPTARG" ;; + S) setact add || exit 1 ; sport="$OPTARG" ;; + u) setact add || exit 1 ; login="$OPTARG" ;; + n) setact add || exit 1 ; realname="$OPTARG" ;; + m) setact add || exit 1 ; maxmes="$OPTARG" ;; + o) setact add || exit 1 ; online=True ;; + f) setact add || exit 1 ; force=True ;; + x) setact add || exit 1 ; password="$OPTARG" ;; + t) setact toggle || exit 1 ; cronmin="$OPTARG" ;; + T) setact toggle || exit 1 ;; + p) echo "NOTE: Protonmail users must install and configure Protonmail Bridge first for the first sync to work." + imap="127.0.0.1" + iport="1143" + smtp="127.0.0.1" + sport="1025" + tlsline="tls_fingerprint $(msmtp --serverinfo --host=$smtp --port=$sport --tls --tls-certcheck=off | awk '/SHA256:/ {print $2}')" + setact add || exit 1 + ;; + *) mwinfo; exit 1 ;; +esac done case "$action" in list) list ;; - add) askinfo && getprofiles && writeinfo && getboxes && finalize || { delete ; exit 1 ;} ;; + add) checkbasics && askinfo && getprofiles && writeinfo && getboxes && finalize || { delete ; exit 1 ;} ;; delete) delete ;; sync) mailsync $fulladdr ;; toggle) togglecron ;; + *) mwinfo; exit 1 ;; esac From c05b6aa92c64728f8f2f80c5d31317e098346596 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 7 Jan 2021 18:35:06 -0500 Subject: [PATCH 090/225] final --- README.md | 55 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 003ff58..700de00 100644 --- a/README.md +++ b/README.md @@ -34,9 +34,9 @@ Specifically, this wizard: - `msmtp` - sends the email. - `pass` - safely encrypts passwords (required at install). -**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 recent version -manually or manually remove the offending lines in the config in +**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 +recent version manually or manually remove the offending lines in the config in `/usr/share/mutt-wizard/mutt-wizard.muttrc`. ```bash @@ -50,12 +50,19 @@ A user of Arch-based distros can also install mutt-wizard from the AUR as ### Optional Dependencies -- `pam-gnupg` - Automatically logs you into your GPG key on login so you will never need to input your password once logged on to your system. Check the repo and directions out [here](https://github.com/cruegge/pam-gnupg). +- `pam-gnupg` - Automatically logs you into your GPG key on login so you will + never need to input your password once logged on to your system. Check the + repo and directions out [here](https://github.com/cruegge/pam-gnupg). - `lynx` - view HTML email in neomutt. -- `notmuch` - index and search mail. Install it and run `notmuch setup`, tell it that your mail is in `~/.local/share/mail/` (although `mw` will do this automatically if you haven't set notmuch up before). You can run it in mutt with `ctrl-f`. Run `notmuch new` to process new mail. -- `abook` - a terminal-based address book. Pressing tab while typing an address to send mail to will suggest contacts that are in your abook. +- `notmuch` - index and search mail. Install it and run `notmuch setup`, tell + it that your mail is in `~/.local/share/mail/` (although `mw` will do this + automatically if you haven't set notmuch up before). You can run it in mutt + with `ctrl-f`. Run `notmuch new` to process new mail. +- `abook` - a terminal-based address book. Pressing tab while typing an address + to send mail to will suggest contacts that are in your abook. - `urlview` - outputs urls in mail to browser. -- `cronie` - (or any other major cronjob manager) to set up automatic mail syncing. +- `cronie` - (or any other major cronjob manager) to set up automatic mail + syncing. ## Usage @@ -185,38 +192,38 @@ See Luke's website [here](https://lukesmith.xyz). Email him at ## Watch out for these things -- Gmail accounts need to create an [App - Password](https://support.google.com/accounts/answer/185833?hl=en) to use - with _**less secure**_ applications. This password is single-use (i.e. for - setup) and will be stored and encrypted locally. Enabling third-party +- Gmail accounts need to create an +- [App Password](https://support.google.com/accounts/answer/185833?hl=en) to + use with _**less secure**_ applications. This password is single-use (i.e. + for setup) and will be stored and encrypted locally. Enabling third-party applications requires turning off two-factor authentication and this will circumvent that. You might also need to manually "Enable IMAP" in the settings. - Protonmail accounts require a "Protonmail Bridge" to access PM's IMAP and SMTP servers. Configure that before running mutt-wizard. Note - that when mutt-wizard asks for a password, you should put in your [bridge - password](https://protonmail.com/bridge/thunderbird#3), not your account - password. + that when mutt-wizard asks for a password, you should put in your + [bridge password](https://protonmail.com/bridge/thunderbird#3), not your + account password. - Protonmail bridge is prone to timing out. Watch out for this while adding an - account. If the bridge times out, try again. It might help to [increase the - timeout](https://protonmail.com/support/knowledge-base/thunderbird-connection-server-timed-error/) + account. If the bridge times out, try again. It might help to + [increase the timeout](https://protonmail.com/support/knowledge-base/thunderbird-connection-server-timed-error/) in your `mbsyncrc`. - 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. - - `isync` is not fully UTF-8 compatible, so non-Latin characters may be garbled - (although sync should succeed). `mw` will also not auto-create mailbox - shortcuts since it is looking for English mailbox names. I strongly recommend - you to set your email language to English on your mail server to avoid these - problems. +- `isync` is not fully UTF-8 compatible, so non-Latin characters may be garbled + (although sync should succeed). `mw` will also not auto-create mailbox + shortcuts since it is looking for English mailbox names. I strongly recommend + you to set your email language to English on your mail server to avoid these + problems. ## To-do - [x] Add Mac OS/BSD compatibility - - [x] Out-of-the-box compatibility with Protonmail Bridge (I believe this is done, but more bug-testing is welcome since I don't have PM) - + ## License -[mutt-wizard](https://github.com/LukeSmithxyz/mutt-wizard) is free/libre software. This program is released under the GPLv3 license, which you can find in the file [LICENSE](LICENSE). +mutt-wizard is free/libre software. This program is released under the GPLv3 +license, which you can find in the file [LICENSE](LICENSE). From 913c877448158ca6a97d6090884fc9ec9a3d9c68 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 7 Jan 2021 20:55:43 -0500 Subject: [PATCH 091/225] detect all Xorgs #fixes #607 --- bin/mailsync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mailsync b/bin/mailsync index 3fac7c5..980b015 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -42,7 +42,7 @@ case "$(uname)" in messageinfo() { osascript -e "display notification with title \"📧 $from\" subtitle \"$subject\"" ;} ;; *) - displays="$(ps axo user,cmd | grep "^$USER\s\+.*Xorg" | grep -wo "[0-9]*:[0-9]\+")" + displays="$(pgrep -a Xorg | grep -wo "[0-9]*:[0-9]\+")" notify() { for x in $displays; do export DISPLAY=$x notify-send --app-name="mutt-wizard" "mutt-wizard" "📬 $2 new mail(s) in \`$1\` account." From d7fd47516f9283e70bd4d0e5f19391e161247919 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 8 Jan 2021 08:36:17 -0500 Subject: [PATCH 092/225] fix #615 --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mw b/bin/mw index a2ad6bd..493a5f2 100755 --- a/bin/mw +++ b/bin/mw @@ -238,7 +238,7 @@ Sent Archive" && return 0 info="$(curl --location-trusted -s -m 5 --user "$login:$(pass $pass_prefix$fulladdr)" --url "${protocol:-imaps}://$imap")" [ -z "$info" ] && echo "Log-on not successful." && return 1 - mailboxes="$(echo "$info" | sed "s/.*\" //" | tr -d ' ')" + mailboxes="$(echo "$info" | sed "s/.*\" //;s/\"//g" | tr -d ' ')" } finalize() { echo "$mailboxes" | xargs -I {} mkdir -p "$maildir/$fulladdr/{}/cur" "$maildir/$fulladdr/{}/tmp" "$maildir/$fulladdr/{}/new" From 3f54e68365bdba9eaa59c496fd7c2a933f2f8081 Mon Sep 17 00:00:00 2001 From: Kr1ss Date: Fri, 8 Jan 2021 22:02:33 +0100 Subject: [PATCH 093/225] [README] add info and link to stable AUR package Since version tags/releases have been introduced lately, Arch users are now able to choose between a 'stable' and a 'development' package. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 700de00..bf17925 100644 --- a/README.md +++ b/README.md @@ -45,8 +45,8 @@ cd mutt-wizard sudo make install ``` -A user of Arch-based distros can also install mutt-wizard from the AUR as -[mutt-wizard-git](https://aur.archlinux.org/packages/mutt-wizard-git/). +A user of Arch-based distros can also install the current mutt-wizard release from the AUR as +[mutt-wizard](https://aur.archlinux.org/packages/mutt-wizard/), or the Github master branch, [mutt-wizard-git](https://aur.archlinux.org/packages/mutt-wizard-git/). ### Optional Dependencies From b56686aae5721da0f26bfac28b97635a363896e7 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 14 Jan 2021 09:12:11 -0500 Subject: [PATCH 094/225] fix notification duplication --- bin/mailsync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mailsync b/bin/mailsync index 980b015..c939347 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -42,7 +42,7 @@ case "$(uname)" in messageinfo() { osascript -e "display notification with title \"📧 $from\" subtitle \"$subject\"" ;} ;; *) - displays="$(pgrep -a Xorg | grep -wo "[0-9]*:[0-9]\+")" + displays="$(pgrep -a Xorg | grep -wo "[0-9]*:[0-9]\+" | sort -u)" notify() { for x in $displays; do export DISPLAY=$x notify-send --app-name="mutt-wizard" "mutt-wizard" "📬 $2 new mail(s) in \`$1\` account." From e5d7ac10f06f0d9dc35b02c6d546b5379b214d1f Mon Sep 17 00:00:00 2001 From: Cloud11665 Date: Sat, 16 Jan 2021 18:32:14 +0100 Subject: [PATCH 095/225] remove https://lukesmith.xyz/crypto --- FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FUNDING.yml b/FUNDING.yml index f8e6076..db8612d 100644 --- a/FUNDING.yml +++ b/FUNDING.yml @@ -1,3 +1,3 @@ github: lukesmithxyz -custom: ["https://lukesmith.xyz/donate", "https://paypal.me/lukemsmith", "https://lukesmith.xyz/crypto"] +custom: ["https://lukesmith.xyz/donate", "https://paypal.me/lukemsmith"] patreon: lukesmith From 3c3daa3508bc16ca9db03e7183e8cbefcb00f65f Mon Sep 17 00:00:00 2001 From: ret2hell Date: Sat, 16 Jan 2021 22:18:16 +0000 Subject: [PATCH 096/225] changed 'gpg --fullgenkey' to the correct command. --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mw b/bin/mw index 493a5f2..4716989 100755 --- a/bin/mw +++ b/bin/mw @@ -25,7 +25,7 @@ checkbasics() { command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2" [ -r "$PASSWORD_STORE_DIR/.gpg-id" ] && "$GPG" --list-secret-keys "$(cat "$PASSWORD_STORE_DIR/.gpg-id")" >/dev/null 2>&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 --fullgenkey\`.)" + echo "(If you don't already have a GPG key pair, first run \`$GPG --full-gen-key\`.)" exit 1 ;} ;} getaccounts() { accounts="$(find -L "$accdir" -type f | grep -o "[0-9]-.*.muttrc" | sed "s/-/: /;s/\.muttrc$//" | sort -n)" ;} From 153c7994703af2494dbe4017161409345f438ae3 Mon Sep 17 00:00:00 2001 From: "Lorenzo IN3HBB (as3ii)" Date: Sun, 17 Jan 2021 00:05:29 +0100 Subject: [PATCH 097/225] added unitn.it related email infos possible email are: - username@studenti.unitn.it - username@ex-studenti.unitn.it - username@alumni.unitn.it - username@unitn.it --- share/domains.csv | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/share/domains.csv b/share/domains.csv index 65251d6..fb39143 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -12,6 +12,7 @@ airmail.cc,mail.cock.li,993,mail.cock.li,587 allergist.com,imap.mail.com,993,smtp.mail.com,587 alumni.bits-pilani.ac.in,imap.gmail.com,993,smtp.gmail.com,465 alumni.com,imap.mail.com,993,smtp.mail.com,587 +alumni.unitn.it,imap.gmail.com,993,smtp.gmail.com,587 alumnidirector.com,imap.mail.com,993,smtp.mail.com,587 alunos.utfpr.edu.br,imap.gmail.com,993,smtp.gmail.com,587 anche.no,mail.autistici.org,993,smtp.autistici.org,465 @@ -93,6 +94,7 @@ ethancoe.com,mail.privateemail.com,993,mail.privateemail.com,465 ethz.ch,mail.ethz.ch,993,mail.ethz.ch,587 etu.upmc.fr,courriel.upmc.fr,993,smtps.upmc.fr,587 europe.com,imap.mail.com,993,smtp.mail.com,587 +ex-studenti.unitn.it,imap.gmail.com,993,smtp.gmail.com,587 fastmail.com,imap.fastmail.com,993,smtp.fastmail.com,465 fastmail.fm,imap.fastmail.com,993,smtp.fastmail.com,465 firemail.cc,mail.cock.li,993,mail.cock.li,587 @@ -241,6 +243,7 @@ student.tuwien.ac.at,mail.student.tuwien.ac.at,993,mail.student.tuwien.ac.at,587 student.uj.edu.pl,outlook.office365.com,993,smtp.office365.com,587 student.utwente.nl,imap.gmail.com,993,smtp.gmail.com,587 studenti.unipi.it,outlook.office365.com,993,smtp.office365.com,587 +studenti.unitn.it,imap.gmail.com,993,smtp.gmail.com,587 students.rmcacs.org,imap.gmail.com,993,smtp.gmail.com,587 students.southwales.ac.uk,imap.gmail.com,993,smtp.gmail.com,587 studio.unibo.it,outlook.office365.com,993,smtp.office365.com,587 @@ -267,6 +270,7 @@ uni-jena.de,imap.uni-jena.de,993,smtp.uni-jena.de,587 unilodz.eu,outlook.office365.com,993,smtp.office365.com,587 unitybox.de,mail.unity-mail.de,993,mail.unity-mail.de,587 univ-ubs.fr,partage.univ-ubs.fr,993,partage.univ-ubs.fr,587 +unitn.it,imap.gmail.com,993,smtp.gmail.com,587 uoregon.edu,imap.uoregon.edu,993,smtp.uoregon.edu,587 uqtr.ca,outlook.office365.com,993,smtp.office365.com,587 usa.com,imap.mail.com,993,smtp.mail.com,587 From b11dcf53dccd33725c7458e884eeb6aa30dcaa4e Mon Sep 17 00:00:00 2001 From: dgrisham Date: Mon, 18 Jan 2021 15:56:28 -0700 Subject: [PATCH 098/225] mailsync: Check whether XDG_CONFIG_HOME is defined before defaulting to $HOME/.config for mutt dir --- bin/mailsync | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/mailsync b/bin/mailsync index 980b015..ecac6af 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -33,6 +33,8 @@ case "$(readlink -f /sbin/init)" in esac export GPG_TTY=$TTY +muttconfig="${XDG_CONFIG_HOME:-$HOME/.config}/mutt" + [ -n "$MBSYNCRC" ] && alias mbsync="mbsync -c $MBSYNCRC" || MBSYNCRC="$HOME/.mbsyncrc" # Settings are different for MacOS (Darwin) systems. @@ -58,7 +60,7 @@ esac syncandnotify() { acc="$(echo "$account" | sed "s/.*\///")" if [ -z "$opts" ]; then mbsync "$acc"; else mbsync "$opts" "$acc"; fi - new=$(find "$HOME/.local/share/mail/$acc/INBOX/new/" "$HOME/.local/share/mail/$acc/Inbox/new/" "$HOME/.local/share/mail/$acc/inbox/new/" -type f -newer "$HOME/.config/mutt/.mailsynclastrun" 2> /dev/null) + new=$(find "$HOME/.local/share/mail/$acc/INBOX/new/" "$HOME/.local/share/mail/$acc/Inbox/new/" "$HOME/.local/share/mail/$acc/inbox/new/" -type f -newer "$muttconfig/.mailsynclastrun" 2> /dev/null) newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l) if [ "$newcount" -gt "0" ]; then notify "$acc" "$newcount" & @@ -91,4 +93,4 @@ wait notmuch new 2>/dev/null #Create a touch file that indicates the time of the last run of mailsync -touch "$HOME/.config/mutt/.mailsynclastrun" +touch "$muttconfig/.mailsynclastrun" From 79bb0437267b55a85bbdcf4f9b635be43091a73f Mon Sep 17 00:00:00 2001 From: Gianni Van Hoecke Date: Fri, 22 Jan 2021 20:26:45 +0100 Subject: [PATCH 099/225] :bug: Set protocol to `imap` when using ProtonMail Part 1 of 2 for "Log-on not successful" bug when using ProtonMail. The curl login check defaults to `imaps` when `protocol` isn't set. Because ProtonMail isn't using any TLS, we have to use the `imap` protocol. The `protocol` variable was never set, so now we set it when the ProtonMail flag (-p) is set. Bug mentioned in: Fixes: - https://github.com/LukeSmithxyz/mutt-wizard/issues/608 - https://github.com/LukeSmithxyz/mutt-wizard/issues/622 --- bin/mw | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/mw b/bin/mw index 4716989..30aabab 100755 --- a/bin/mw +++ b/bin/mw @@ -351,6 +351,7 @@ while getopts "fplhodTYD:y:i:I:s:S:u:a:n:x:m:t:" o; do case "${o}" in t) setact toggle || exit 1 ; cronmin="$OPTARG" ;; T) setact toggle || exit 1 ;; p) echo "NOTE: Protonmail users must install and configure Protonmail Bridge first for the first sync to work." + protocol="imap" imap="127.0.0.1" iport="1143" smtp="127.0.0.1" From 5920ca462db40309e927e1d58feb08023968e687 Mon Sep 17 00:00:00 2001 From: Gianni Van Hoecke Date: Fri, 22 Jan 2021 20:33:29 +0100 Subject: [PATCH 100/225] :bug: Supply imap port to curl login check Part 2 of 2 for "Log-on not successful" bug when using ProtonMail. The curl login check uses the imap(s) protocol, which means it will use the default ports. However, when using ProtonMail, these ports are different (namely 1143 instead of 993). We now use the port variable in the curl login command, defaulting to 993 when the port was not overridden. The port variable was already set when the ProtonMail flag (-p) was set. Bug mentioned in: Fixes: - https://github.com/LukeSmithxyz/mutt-wizard/issues/608 - https://github.com/LukeSmithxyz/mutt-wizard/issues/622 --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mw b/bin/mw index 30aabab..67c389d 100755 --- a/bin/mw +++ b/bin/mw @@ -236,7 +236,7 @@ Junk Trash Sent Archive" && return 0 - info="$(curl --location-trusted -s -m 5 --user "$login:$(pass $pass_prefix$fulladdr)" --url "${protocol:-imaps}://$imap")" + info="$(curl --location-trusted -s -m 5 --user "$login:$(pass $pass_prefix$fulladdr)" --url "${protocol:-imaps}://$imap:${iport:-993}")" [ -z "$info" ] && echo "Log-on not successful." && return 1 mailboxes="$(echo "$info" | sed "s/.*\" //;s/\"//g" | tr -d ' ')" } From 3589c36a381a776776191752265f926a03275ff2 Mon Sep 17 00:00:00 2001 From: PRESFIL Date: Sat, 23 Jan 2021 00:29:20 +0300 Subject: [PATCH 101/225] Fix: `macro index o` overlapping with next account When the transition is made from an offline profile to an online profile, there is still someone else's macro - side effects... Variables, macros, and so on must be taken-into-account **symmetrically** with any of the `mutt-wizard`'s profiles. --- bin/mw | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/mw b/bin/mw index 67c389d..f6fd6c0 100755 --- a/bin/mw +++ b/bin/mw @@ -122,6 +122,7 @@ bind index,pager g noop bind index,pager M noop bind index,pager C noop bind index gg first-entry +unmacro index o unmailboxes * " fi From 718e586f4a8b6b097f0817fb0ac439a9a2650ca3 Mon Sep 17 00:00:00 2001 From: Francesco Minnocci Date: Sat, 23 Jan 2021 11:38:04 +0100 Subject: [PATCH 102/225] mailsync: Check for ZDOTDIR when looking for environmental variables inside .zprofile and .zshrc. ~/.profile is not necessarily present when using zsh for login and setting $ZDOTDIR in ~/.zshenv --- bin/mailsync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mailsync b/bin/mailsync index ecac6af..42cd4e0 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -22,7 +22,7 @@ pgrep -x mbsync >/dev/null && { echo "mbsync is already running." ; exit ;} # will work on the maximum number of machines. eval "$(grep -h -- \ "^\s*\(export \)\?\(MBSYNCRC\|PASSWORD_STORE_DIR\|NOTMUCH_CONFIG\|GNUPGHOME\)=" \ - "$HOME/.profile" "$HOME/.bash_profile" "$HOME/.zprofile" "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.pam_environment" 2>/dev/null)" + "$HOME/.profile" "$HOME/.bash_profile" "${ZDOTDIR:-$HOME}/.zprofile" "$HOME/.bashrc" "${ZDOTDIR:-$HOME}/.zshrc" "$HOME/.pam_environment" 2>/dev/null)" # One alternative to this kind of command would be marking the script for # /bin/sh -l. That might cause other problems on other particular setups that # do more complicated things on login, or those people who assign environmental From c3aa6733f2cb723523598f4ad6b6b49d82849c1e Mon Sep 17 00:00:00 2001 From: Aaron Friesen Date: Sun, 24 Jan 2021 15:39:51 -0600 Subject: [PATCH 103/225] Fix duplicate mailsync notifications --- bin/mailsync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mailsync b/bin/mailsync index 42cd4e0..dfcd7da 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -44,7 +44,7 @@ case "$(uname)" in messageinfo() { osascript -e "display notification with title \"📧 $from\" subtitle \"$subject\"" ;} ;; *) - displays="$(pgrep -a Xorg | grep -wo "[0-9]*:[0-9]\+")" + displays="$(pgrep -a Xorg | grep -wo "[0-9]*:[0-9]\+" | uniq)" notify() { for x in $displays; do export DISPLAY=$x notify-send --app-name="mutt-wizard" "mutt-wizard" "📬 $2 new mail(s) in \`$1\` account." From 978cd4eb98e2e400b2010ff2f7476436b475d816 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sun, 24 Jan 2021 19:14:44 -0500 Subject: [PATCH 104/225] for zdotdir changes; close #639 --- bin/mailsync | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/bin/mailsync b/bin/mailsync index 7bad83d..8ca83c6 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -22,19 +22,14 @@ pgrep -x mbsync >/dev/null && { echo "mbsync is already running." ; exit ;} # will work on the maximum number of machines. eval "$(grep -h -- \ "^\s*\(export \)\?\(MBSYNCRC\|PASSWORD_STORE_DIR\|NOTMUCH_CONFIG\|GNUPGHOME\)=" \ - "$HOME/.profile" "$HOME/.bash_profile" "${ZDOTDIR:-$HOME}/.zprofile" "$HOME/.bashrc" "${ZDOTDIR:-$HOME}/.zshrc" "$HOME/.pam_environment" 2>/dev/null)" -# One alternative to this kind of command would be marking the script for -# /bin/sh -l. That might cause other problems on other particular setups that -# do more complicated things on login, or those people who assign environmental -# variables in shell rc files. + "$HOME/.profile" "$HOME/.bash_profile" "$HOME/.zprofile" "$HOME/.config/zsh/.zprofile" \ + "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.config/zsh/.zshrc" "$HOME/.pam_environment" 2>/dev/null)" case "$(readlink -f /sbin/init)" in *systemd*) export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus ;; esac export GPG_TTY=$TTY -muttconfig="${XDG_CONFIG_HOME:-$HOME/.config}/mutt" - [ -n "$MBSYNCRC" ] && alias mbsync="mbsync -c $MBSYNCRC" || MBSYNCRC="$HOME/.mbsyncrc" # Settings are different for MacOS (Darwin) systems. @@ -60,7 +55,7 @@ esac syncandnotify() { acc="$(echo "$account" | sed "s/.*\///")" if [ -z "$opts" ]; then mbsync "$acc"; else mbsync "$opts" "$acc"; fi - new=$(find "$HOME/.local/share/mail/$acc/INBOX/new/" "$HOME/.local/share/mail/$acc/Inbox/new/" "$HOME/.local/share/mail/$acc/inbox/new/" -type f -newer "$muttconfig/.mailsynclastrun" 2> /dev/null) + new=$(find "$HOME/.local/share/mail/$acc/INBOX/new/" "$HOME/.local/share/mail/$acc/Inbox/new/" "$HOME/.local/share/mail/$acc/inbox/new/" -type f -newer "${XDG_CONFIG_HOME:-$HOME/.config}/mutt/.mailsynclastrun" 2> /dev/null) newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l) if [ "$newcount" -gt "0" ]; then notify "$acc" "$newcount" & @@ -93,4 +88,4 @@ wait notmuch new 2>/dev/null #Create a touch file that indicates the time of the last run of mailsync -touch "$muttconfig/.mailsynclastrun" +touch "${XDG_CONFIG_HOME:-$HOME/.config}/mutt/.mailsynclastrun" From 9662299d4e508f4c6706c7c6709730f06e60aa52 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sat, 30 Jan 2021 16:12:11 -0500 Subject: [PATCH 105/225] bugfixes and simplification. fixes #517 #546 #600 #632 remove old vars like pass_prefix, muttdir reorder mailbox detection to find inbox case and later delim offline delim set to _ which should avoid most issues --- bin/mw | 91 ++++++++++++++++++++++++++-------------------------------- 1 file changed, 41 insertions(+), 50 deletions(-) diff --git a/bin/mw b/bin/mw index f6fd6c0..cf42822 100755 --- a/bin/mw +++ b/bin/mw @@ -1,19 +1,15 @@ #!/bin/sh prefix="/usr/local" -pass_prefix="mw-" -muttdir="${XDG_CONFIG_HOME:-$HOME/.config}/mutt" # Main mutt config location -accdir="$muttdir/accounts" # Directory for account settings -maildir="${XDG_DATA_HOME:-$HOME/.local/share}/mail" # Location of mail storage -emailre=".+@.+\..+" # Regex to confirm valid email address +maildir="${XDG_DATA_HOME:-$HOME/.local/share}/mail" muttshare="$prefix/share/mutt-wizard" -mbsyncrc="${MBSYNCRC:-$HOME/.mbsyncrc}" mwconfig="$muttshare/mutt-wizard.muttrc" cachedir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard" -muttrc="$muttdir/muttrc" +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_CONFIG_HOME:-$HOME/.config}/msmtp/msmtp.log" -marker="# mw-autogenerated" +mbsyncrc="${MBSYNCRC:-$HOME/.mbsyncrc}" alias mbsync='mbsync -c "$mbsyncrc"' for x in "/etc/ssl/certs/ca-certificates.crt" "/etc/pki/tls/certs/ca-bundle.crt" "/etc/ssl/ca-bundle.pem" "/etc/pki/tls/cacert.pem" "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem" "/etc/ssl/cert.pem" "/usr/local/share/ca-certificates/"; do @@ -25,10 +21,10 @@ checkbasics() { command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2" [ -r "$PASSWORD_STORE_DIR/.gpg-id" ] && "$GPG" --list-secret-keys "$(cat "$PASSWORD_STORE_DIR/.gpg-id")" >/dev/null 2>&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-gen-key\`.)" + 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 | grep -o "[0-9]-.*.muttrc" | sed "s/-/: /;s/\.muttrc$//" | sort -n)" ;} +getaccounts() { accounts="$(find -L "$accdir" -type f 2>/dev/null | grep -o "[0-9]-.*.muttrc" | sed "s/-/: /;s/\.muttrc$//" | sort -n)" ;} list() { getaccounts && [ -n "$accounts" ] && echo "$accounts" ;} @@ -49,14 +45,14 @@ host $smtp port ${sport:-587} from $fulladdr user $login -passwordeval \"pass $pass_prefix$fulladdr\" +passwordeval \"pass $fulladdr\" $tlsline " mbsync_profile="IMAPStore $fulladdr-remote Host $imap Port ${iport:-993} User $login -PassCmd \"pass $pass_prefix$fulladdr\" +PassCmd \"pass $fulladdr\" AuthMechs LOGIN SSLType ${imapssl:-IMAPS} CertificateFile $sslcert @@ -64,8 +60,8 @@ CertificateFile $sslcert MaildirStore $fulladdr-local Subfolders Verbatim Path ${XDG_DATA_HOME:-$HOME/.local/share}/mail/$fulladdr/ -Inbox ${XDG_DATA_HOME:-$HOME/.local/share}/mail/$fulladdr/INBOX -Flatten . +Inbox ${XDG_DATA_HOME:-$HOME/.local/share}/mail/$fulladdr/${inbox:-INBOX} +Flatten _ Channel $fulladdr Expunge Both @@ -111,7 +107,7 @@ set folder = \"imaps://$login@$imap:${iport:-993}\" set imap_user = \"$login\" set header_cache = $cachedir/$fulladdr/headers set message_cachedir = $cachedir/$fulladdr/bodies -set imap_pass = \"\`pass $pass_prefix$fulladdr\`\" +set imap_pass = \"\`pass $fulladdr\`\" set mbox_type = Maildir set ssl_starttls = yes @@ -159,7 +155,7 @@ delete() { if [ -z "${fulladdr+x}" ]; then rm -rf "${cachedir:?}/${fulladdr:?}" "$accdir/"[1-9]"-$fulladdr.muttrc" sed -ibu "/[0-9]-$fulladdr.muttrc/d" "$muttrc" ; rm -f "$muttrc"bu sed -ibu "/account $fulladdr/,/^\(\s*$\|account\)/d" "$msmtprc"; rm -f "$msmtprc"bu - pass rm -f "$pass_prefix$fulladdr" >/dev/null 2>&1 + pass rm -f "$fulladdr" >/dev/null 2>&1 # Get rid of those multiple newlines because I don't know awk well enough to do it by default lol. for file in "$msmtprc" "$mbsyncrc"; do @@ -171,11 +167,11 @@ delete() { if [ -z "${fulladdr+x}" ]; then askinfo() { \ [ -z "$fulladdr" ] && echo "Give the full email address to add:" && read -r fulladdr - while ! echo "$fulladdr" | grep -qE "$emailre"; do + while ! echo "$fulladdr" | grep -qE ".+@.+\..+"; do echo "\`$fulladdr\` is not a valid email address. Please retype the address:" read -r fulladdr done - grep -q "Channel\s*$fulladdr$" "$mbsyncrc" && + grep -q "Channel\s*$fulladdr$" "$mbsyncrc" 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):" && @@ -192,14 +188,11 @@ askinfo() { \ fi } -createpass() { echo "$password" > "$PASSWORD_STORE_DIR/$pass_prefix$fulladdr" - "$GPG" -qer "$(cat "$PASSWORD_STORE_DIR/.gpg-id")" "$PASSWORD_STORE_DIR/$pass_prefix$fulladdr" - rm -f "$PASSWORD_STORE_DIR/$pass_prefix$fulladdr" ;} - -writeinfo() { mkdir -p "$muttdir" "$accdir" "$cachedir/$fulladdr/bodies" "${XDG_CONFIG_HOME:-$HOME/.config}/msmtp" "$maildir/$fulladdr" +createpass() { echo "$password" > "$PASSWORD_STORE_DIR/$fulladdr" + "$GPG" -qer "$(cat "$PASSWORD_STORE_DIR/.gpg-id")" "$PASSWORD_STORE_DIR/$fulladdr" + rm -f "$PASSWORD_STORE_DIR/$fulladdr" ;} - # Get accounts and find the first missing account number (max. 9). - getaccounts; for x in $(seq 1 9); do echo "$accounts" | grep -q "$x" || { export idnum="$x"; break ;}; done +writeinfo() { mkdir -p "${muttrc%/*}" "$accdir" "$cachedir/$fulladdr/bodies" "${XDG_CONFIG_HOME:-$HOME/.config}/msmtp" "$maildir/$fulladdr" # Configure msmtprc for sending mail. [ ! -f "$msmtprc" ] && echo "$msmtp_header" > "$msmtprc" @@ -213,37 +206,32 @@ writeinfo() { mkdir -p "$muttdir" "$accdir" "$cachedir/$fulladdr/bodies" "${XDG_ # Create a muttrc for viewing mail. echo "$mutt_profile" > "$accdir/$idnum-$fulladdr.muttrc" [ ! -f "$muttrc" ] && echo "# vim: filetype=neomuttrc" > "$muttrc" - ! grep -q "^source.*mutt-wizard.muttrc" "$muttrc" && echo "source $mwconfig $marker" >> "$muttrc" - ! grep "^source.*.muttrc" "$muttrc" | grep -qv "$mwconfig" && echo "source $accdir/$idnum-$fulladdr.muttrc $marker" >> "$muttrc" - echo "macro index,pager i$idnum 'source $accdir/$idnum-$fulladdr.muttrc!;' \"switch to $fulladdr\" $marker" >> "$muttrc" + ! grep -q "^source.*mutt-wizard.muttrc" "$muttrc" && echo "source $mwconfig" >> "$muttrc" + ! grep "^source.*.muttrc" "$muttrc" | grep -qv "$mwconfig" && echo "source $accdir/$idnum-$fulladdr.muttrc" >> "$muttrc" + echo "macro index,pager i$idnum 'source $accdir/$idnum-$fulladdr.muttrc!;' \"switch to $fulladdr\"" >> "$muttrc" notmuchauto # Create a notmuch config file if not present already. } -getpass() { while : ; do pass rm -f "$pass_prefix$fulladdr" >/dev/null 2>&1 - pass insert "$pass_prefix$fulladdr" && break; done ;} +getpass() { while : ; do pass rm -f "$fulladdr" >/dev/null 2>&1 + pass insert "$fulladdr" && break; done ;} formatShortcut() { toappend="$toappend -macro index,pager g$1 \"=$3\" \"go to $2\" $marker -macro index,pager M$1 \";=$3\" \"move mail to $2\" $marker -macro index,pager C$1 \";=$3\" \"copy mail to $2\" $marker" >> "$accdir/$idnum-$fulladdr.muttrc" ;} +macro index,pager g$1 \"=$3\" \"go to $2\" +macro index,pager M$1 \";=$3\" \"move mail to $2\" +macro index,pager C$1 \";=$3\" \"copy mail to $2\"" ;} setBox() { toappend="$toappend -set $1 = \"+$2\" $marker" ;} - -getboxes() { [ -n "${force+x}" ] && mailboxes="INBOX -Drafts -Junk -Trash -Sent -Archive" && return 0 - info="$(curl --location-trusted -s -m 5 --user "$login:$(pass $pass_prefix$fulladdr)" --url "${protocol:-imaps}://$imap:${iport:-993}")" - [ -z "$info" ] && echo "Log-on not successful." && return 1 - mailboxes="$(echo "$info" | sed "s/.*\" //;s/\"//g" | tr -d ' ')" -} +set $1 = \"+$2\"" ;} -finalize() { echo "$mailboxes" | xargs -I {} mkdir -p "$maildir/$fulladdr/{}/cur" "$maildir/$fulladdr/{}/tmp" "$maildir/$fulladdr/{}/new" - sed -ibu "/$marker/d" "$accdir/$idnum-$fulladdr.muttrc" ; rm -f "$accdir/$idnum-$fulladdr.muttrcbu" +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 $fulladdr)" --url "${protocol:-imaps}://$imap:${iport:-993}")" + [ -z "$info" ] && echo "Log-on not successful." && return 1 + mailboxes="$(echo "$info" | sed "s/.*\" //;s/\"//g" | tr -d ' ')" + fi + getaccounts; for x in $(seq 1 9); do echo "$accounts" | grep -q "^$x:" || { export idnum="$x"; break ;}; done toappend="mailboxes $(echo "$mailboxes" | sed "s/^/\"=/;s/$/\"/" | paste -sd ' ' - )" for x in $mailboxes; do case "$x" in @@ -253,9 +241,12 @@ finalize() { echo "$mailboxes" | xargs -I {} mkdir -p "$maildir/$fulladdr/{}/cur *[Jj][Uu][Nn][Kk]*) formatShortcut j junk "$x" ;; *[Aa][Rr][Cc][Hh][Ii][Vv][Ee]*) formatShortcut a archive "$x" ;; *[Ss][Pp][Aa][Mm]*) formatShortcut S spam "$x" ;; - *[Ii][Nn][Bb][Oo][Xx]*) formatShortcut i inbox "$x"; setBox spoolfile "$x" ;; + *[Ii][Nn][Bb][Oo][Xx]*) formatShortcut i inbox "$x"; setBox spoolfile "$x" inbox="$x" ;; esac done +} + +finalize() { echo "$mailboxes" | xargs -I {} mkdir -p "$maildir/$fulladdr/{}/cur" "$maildir/$fulladdr/{}/tmp" "$maildir/$fulladdr/{}/new" echo "$toappend" >> "$accdir/$idnum-$fulladdr.muttrc" [ -z "${online+x}" ] && echo "$fulladdr (account #$idnum) added successfully." command -V urlview >/dev/null 2>&1 && [ ! -f "$HOME/.urlview" ] && echo "COMMAND \$BROWSER" > "$HOME/.urlview" @@ -328,7 +319,7 @@ Options allowed with -a: NOTE: Once at least one account is added, you can run \`mbsync -a\` to begin downloading mail. -To change an account's password, run \`pass edit ${pass_prefix}your@email.com\`. +To change an account's password, run \`pass edit your@email.com\`. EOF } @@ -365,7 +356,7 @@ esac done case "$action" in list) list ;; - add) checkbasics && askinfo && getprofiles && writeinfo && getboxes && finalize || { delete ; exit 1 ;} ;; + add) checkbasics && askinfo && getboxes && getprofiles && writeinfo && finalize || { delete ; exit 1 ;} ;; delete) delete ;; sync) mailsync $fulladdr ;; toggle) togglecron ;; From ea98dd667835c9b2f30bd05342aac3cc2aa199ba Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sat, 30 Jan 2021 22:00:15 -0500 Subject: [PATCH 106/225] fix #606 --- bin/mw | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/mw b/bin/mw index cf42822..bcac4ea 100755 --- a/bin/mw +++ b/bin/mw @@ -118,6 +118,7 @@ bind index,pager g noop bind index,pager M noop bind index,pager C noop bind index gg first-entry +unset signature unmacro index o unmailboxes * " From dccd4d4cbf741c2c0d06e761bc1fb63561d5f1e6 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Mon, 1 Feb 2021 13:51:12 -0500 Subject: [PATCH 107/225] dox --- README.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/README.md b/README.md index bf17925..93bbf0a 100644 --- a/README.md +++ b/README.md @@ -193,7 +193,7 @@ See Luke's website [here](https://lukesmith.xyz). Email him at ## Watch out for these things - Gmail accounts need to create an -- [App Password](https://support.google.com/accounts/answer/185833?hl=en) to + [App Password](https://support.google.com/accounts/answer/185833?hl=en) to use with _**less secure**_ applications. This password is single-use (i.e. for setup) and will be stored and encrypted locally. Enabling third-party applications requires turning off two-factor authentication and this will @@ -217,12 +217,6 @@ See Luke's website [here](https://lukesmith.xyz). Email him at you to set your email language to English on your mail server to avoid these problems. -## To-do - -- [x] Add Mac OS/BSD compatibility -- [x] Out-of-the-box compatibility with Protonmail Bridge (I believe this is - done, but more bug-testing is welcome since I don't have PM) - ## License mutt-wizard is free/libre software. This program is released under the GPLv3 From 0ff14fee55e68e59df6a40d72205f8953df056a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20DOUIN?= Date: Tue, 2 Feb 2021 22:49:15 +0100 Subject: [PATCH 108/225] fix notifications on Xwayland --- bin/mailsync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mailsync b/bin/mailsync index 8ca83c6..6741804 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -39,7 +39,7 @@ case "$(uname)" in messageinfo() { osascript -e "display notification with title \"📧 $from\" subtitle \"$subject\"" ;} ;; *) - displays="$(pgrep -a Xorg | grep -wo "[0-9]*:[0-9]\+" | sort -u)" + displays="$(pgrep -a X\(org\|wayland\) | grep -wo "[0-9]*:[0-9]\+" | sort -u)" notify() { for x in $displays; do export DISPLAY=$x notify-send --app-name="mutt-wizard" "mutt-wizard" "📬 $2 new mail(s) in \`$1\` account." From 06ec18b8a6d624f3b342fe5173d1ca5a48bea7ab Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 5 Feb 2021 11:41:35 -0500 Subject: [PATCH 109/225] fix #643 --- bin/mw | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/mw b/bin/mw index bcac4ea..03abc4d 100755 --- a/bin/mw +++ b/bin/mw @@ -48,7 +48,8 @@ user $login passwordeval \"pass $fulladdr\" $tlsline " -mbsync_profile="IMAPStore $fulladdr-remote +mbsync_profile=" +IMAPStore $fulladdr-remote Host $imap Port ${iport:-993} User $login From a95ff5a471a991ba3acfc5995141fef85a37209a Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 5 Feb 2021 12:29:06 -0500 Subject: [PATCH 110/225] no longer flatten mailboxes at all, fix #648 --- bin/mw | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bin/mw b/bin/mw index 03abc4d..e8d02f1 100755 --- a/bin/mw +++ b/bin/mw @@ -62,7 +62,6 @@ MaildirStore $fulladdr-local Subfolders Verbatim Path ${XDG_DATA_HOME:-$HOME/.local/share}/mail/$fulladdr/ Inbox ${XDG_DATA_HOME:-$HOME/.local/share}/mail/$fulladdr/${inbox:-INBOX} -Flatten _ Channel $fulladdr Expunge Both @@ -231,7 +230,7 @@ getboxes() { if [ -n "${force+x}" ]; then else info="$(curl --location-trusted -s -m 5 --user "$login:$(pass $fulladdr)" --url "${protocol:-imaps}://$imap:${iport:-993}")" [ -z "$info" ] && echo "Log-on not successful." && return 1 - mailboxes="$(echo "$info" | sed "s/.*\" //;s/\"//g" | tr -d ' ')" + mailboxes="$(echo "$info" | grep -v HasChildren | sed "s/.*\" //;s/\"//g" | tr -d ' ')" fi getaccounts; for x in $(seq 1 9); do echo "$accounts" | grep -q "^$x:" || { export idnum="$x"; break ;}; done toappend="mailboxes $(echo "$mailboxes" | sed "s/^/\"=/;s/$/\"/" | paste -sd ' ' - )" From ddbf60ac093cab27d01497a5f0cfd44d4a3c0d5a Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 5 Feb 2021 15:08:28 -0500 Subject: [PATCH 111/225] prepare for addition of pop (not finished) --- bin/mw | 147 +++++++++++++++++++++++++++------------------------------ 1 file changed, 70 insertions(+), 77 deletions(-) diff --git a/bin/mw b/bin/mw index e8d02f1..23d9e68 100755 --- a/bin/mw +++ b/bin/mw @@ -10,6 +10,7 @@ accdir="${XDG_CONFIG_HOME:-$HOME/.config}/mutt/accounts" msmtprc="${XDG_CONFIG_HOME:-$HOME/.config}/msmtp/config" msmtplog="${XDG_CONFIG_HOME:-$HOME/.config}/msmtp/msmtp.log" mbsyncrc="${MBSYNCRC:-$HOME/.mbsyncrc}" +mpoprc="${XDG_CONFIG_HOME:-$HOME/.config}/mpop/config" alias mbsync='mbsync -c "$mbsyncrc"' for x in "/etc/ssl/certs/ca-certificates.crt" "/etc/pki/tls/certs/ca-bundle.crt" "/etc/ssl/ca-bundle.pem" "/etc/pki/tls/cacert.pem" "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem" "/etc/ssl/cert.pem" "/usr/local/share/ca-certificates/"; do @@ -28,27 +29,23 @@ getaccounts() { accounts="$(find -L "$accdir" -type f 2>/dev/null | grep -o "[0- list() { getaccounts && [ -n "$accounts" ] && echo "$accounts" ;} -getprofiles() { \ - unset msmtp_header msmtp_profile mutt_profile mbsync_profile - case "$iport" in - 1143) imapssl=None ;; - 143) imapssl=STARTTLS ;; - esac -msmtp_header="defaults -auth on -tls on -tls_trust_file $sslcert -logfile $msmtplog -" -msmtp_profile="account $fulladdr +prepmsmtp() { echo "account $fulladdr host $smtp port ${sport:-587} from $fulladdr user $login passwordeval \"pass $fulladdr\" -$tlsline -" -mbsync_profile=" +auth on +${tlsline:-tls on} +tls_trust_file $sslcert +logfile $msmtplog +" >> "$msmtprc" + # On Ubuntu/Debian, a link is needed since they use an older version. + command -V apt-get >/dev/null 2>&1 && ln -s "$msmtprc" "$HOME/.msmtprc" 2>/dev/null +} + +prepmbsync() { mkdir -p "${mbsyncrc%/*}" + echo " IMAPStore $fulladdr-remote Host $imap Port ${iport:-993} @@ -73,56 +70,71 @@ SyncState * MaxMessages ${maxmes:-0} ExpireUnread no # End profile -" +" >> "$mbsyncrc" ;} + +prepmpop() { echo " +account $fulladdr +tls on +user $login +host $imap +delivery maildir ${XDG_DATA_HOME:-$HOME/.local/share}/mail/$fulladdr/${inbox:-INBOX} +passwordeval pass $fulladdr +" >> "$mpoprc" ;} -if [ -z "${online+x}" ]; then -mutt_profile="# vim: filetype=neomuttrc +prepmutt() { echo "# vim: filetype=neomuttrc # muttrc file for account $fulladdr set realname = \"$realname\" set from = \"$fulladdr\" set sendmail = \"msmtp -a $fulladdr\" alias me $realname <$fulladdr> -set folder = \"$maildir/$fulladdr\" +set folder = \"$folder\" set header_cache = $cachedir/$fulladdr/headers set message_cachedir = $cachedir/$fulladdr/bodies set mbox_type = Maildir +$extra bind index,pager gg noop bind index,pager g noop bind index,pager M noop bind index,pager C noop bind index gg first-entry -macro index o \"mw -y $fulladdr\" \"run mbsync to sync $fulladdr\" unmailboxes * unalternates * -" -else -mutt_profile="# vim: filetype=neomuttrc -# muttrc file for account $fulladdr -set realname = \"$realname\" -set from = \"$fulladdr\" -set sendmail = \"msmtp -a $fulladdr\" -alias me $realname <$fulladdr> -set folder = \"imaps://$login@$imap:${iport:-993}\" -set imap_user = \"$login\" -set header_cache = $cachedir/$fulladdr/headers -set message_cachedir = $cachedir/$fulladdr/bodies -set imap_pass = \"\`pass $fulladdr\`\" +unset signature +unmacro index o +$synccmd +" > "$accdir/$idnum-$fulladdr.muttrc" -set mbox_type = Maildir + [ ! -f "$muttrc" ] && echo "# vim: filetype=neomuttrc" > "$muttrc" + ! grep -q "^source.*mutt-wizard.muttrc" "$muttrc" && echo "source $mwconfig" >> "$muttrc" + ! grep "^source.*.muttrc" "$muttrc" | grep -qv "$mwconfig" && echo "source $accdir/$idnum-$fulladdr.muttrc" >> "$muttrc" + echo "macro index,pager i$idnum 'source $accdir/$idnum-$fulladdr.muttrc!;' \"switch to $fulladdr\"" >> "$muttrc" +} + +getprofiles() { \ + mkdir -p "${muttrc%/*}" "$accdir" "$cachedir/$fulladdr/bodies" "${XDG_CONFIG_HOME:-$HOME/.config}/msmtp" + unset msmtp_header msmtp_profile mutt_profile mbsync_profile + case "$iport" in + 1143) imapssl=None ;; + 143) imapssl=STARTTLS ;; + esac + case "$type" in + online) folder="imaps://$login@$imap:${iport:-993}" +extra="set imap_user = \"$login\" +set imap_pass = \"\`pass $fulladdr\`\" set ssl_starttls = yes -set ssl_force_tls = yes +set ssl_force_tls = yes" + ;; + pop) synccmd="macro index o \"mpop $fulladdr\" \"run mpop to get $fulladdr's mail\"" + prepmpop ;; + *) synccmd="macro index o \"mw -y $fulladdr\" \"run mbsync to sync $fulladdr\"" + folder="$maildir/$fulladdr" + prepmbsync ;; + esac + prepmsmtp + prepmutt -bind index,pager gg noop -bind index,pager g noop -bind index,pager M noop -bind index,pager C noop -bind index gg first-entry -unset signature -unmacro index o -unmailboxes * -" -fi + prepnotmuch # Create a notmuch config file if not present already. } parsedomains(){ serverinfo="$(grep "^${fulladdr#*@}" "$muttshare/domains.csv" 2>/dev/null)" @@ -172,7 +184,7 @@ askinfo() { \ echo "\`$fulladdr\` is not a valid email address. Please retype the address:" read -r fulladdr done - grep -q "Channel\s*$fulladdr$" "$mbsyncrc" 2>/dev/null && + 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):" && @@ -193,27 +205,6 @@ createpass() { echo "$password" > "$PASSWORD_STORE_DIR/$fulladdr" "$GPG" -qer "$(cat "$PASSWORD_STORE_DIR/.gpg-id")" "$PASSWORD_STORE_DIR/$fulladdr" rm -f "$PASSWORD_STORE_DIR/$fulladdr" ;} -writeinfo() { mkdir -p "${muttrc%/*}" "$accdir" "$cachedir/$fulladdr/bodies" "${XDG_CONFIG_HOME:-$HOME/.config}/msmtp" "$maildir/$fulladdr" - - # Configure msmtprc for sending mail. - [ ! -f "$msmtprc" ] && echo "$msmtp_header" > "$msmtprc" - echo "$msmtp_profile" >> "$msmtprc" - # On Ubuntu/Debian, a link is needed since they use an older version. - command -V apt-get >/dev/null 2>&1 && ln -s "$msmtprc" "$HOME/.msmtprc" 2>/dev/null - - # Create the mbsync config file if local account. - [ -z "${online+x}" ] && mkdir -p "${mbsyncrc%/*}" && echo "$mbsync_profile" >> "$mbsyncrc" - - # Create a muttrc for viewing mail. - echo "$mutt_profile" > "$accdir/$idnum-$fulladdr.muttrc" - [ ! -f "$muttrc" ] && echo "# vim: filetype=neomuttrc" > "$muttrc" - ! grep -q "^source.*mutt-wizard.muttrc" "$muttrc" && echo "source $mwconfig" >> "$muttrc" - ! grep "^source.*.muttrc" "$muttrc" | grep -qv "$mwconfig" && echo "source $accdir/$idnum-$fulladdr.muttrc" >> "$muttrc" - echo "macro index,pager i$idnum 'source $accdir/$idnum-$fulladdr.muttrc!;' \"switch to $fulladdr\"" >> "$muttrc" - - notmuchauto # Create a notmuch config file if not present already. -} - getpass() { while : ; do pass rm -f "$fulladdr" >/dev/null 2>&1 pass insert "$fulladdr" && break; done ;} @@ -247,13 +238,13 @@ getboxes() { if [ -n "${force+x}" ]; then done } -finalize() { echo "$mailboxes" | xargs -I {} mkdir -p "$maildir/$fulladdr/{}/cur" "$maildir/$fulladdr/{}/tmp" "$maildir/$fulladdr/{}/new" - echo "$toappend" >> "$accdir/$idnum-$fulladdr.muttrc" - [ -z "${online+x}" ] && echo "$fulladdr (account #$idnum) added successfully." +finalize() { echo "$toappend" >> "$accdir/$idnum-$fulladdr.muttrc" + [ "$type" != "online" ] && echo "$mailboxes" | xargs -I {} mkdir -p "$maildir/$fulladdr/{}/cur" "$maildir/$fulladdr/{}/tmp" "$maildir/$fulladdr/{}/new" + echo "$fulladdr (account #$idnum) added successfully." command -V urlview >/dev/null 2>&1 && [ ! -f "$HOME/.urlview" ] && echo "COMMAND \$BROWSER" > "$HOME/.urlview" return 0 ;} -notmuchauto() { \ +prepnotmuch() { \ [ -z "$NOTMUCH_CONFIG" ] && NOTMUCH_CONFIG="$HOME/.notmuch-config" [ -f "$NOTMUCH_CONFIG" ] && return 0 nmbasic="[database] @@ -308,12 +299,13 @@ Main actions: Options allowed with -a: -u Account login name if not full address -n "Real name" to be on the email account - -i IMAP server address - -I IMAP server port + -i IMAP/POP server address + -I IMAP/POP server port -s SMTP server address -S SMTP server port -x Password for account (recommended to be in double quotes) -p Install for a Protonmail account. + -P Add for a POP server instead of IMAP -o Configure address, but keep mail online. -f Assume typical English mailboxes without attempting log-on. @@ -324,7 +316,7 @@ To change an account's password, run \`pass edit your@email.com\`. EOF } -while getopts "fplhodTYD:y:i:I:s:S:u:a:n:x:m:t:" o; do case "${o}" in +while getopts "fpPlhodTYD:y:i:I:s:S:u:a:n:x:m:t:" o; do case "${o}" in l) setact list || exit 1 ;; d) setact delete || exit 1 ;; D) setact delete || exit 1 ; fulladdr="$OPTARG" ;; @@ -338,7 +330,8 @@ while getopts "fplhodTYD:y:i:I:s:S:u:a:n:x:m:t:" o; do case "${o}" in u) setact add || exit 1 ; login="$OPTARG" ;; n) setact add || exit 1 ; realname="$OPTARG" ;; m) setact add || exit 1 ; maxmes="$OPTARG" ;; - o) setact add || exit 1 ; online=True ;; + o) setact add || exit 1 ; type="online" ;; + P) setact add || exit 1 ; type="pop" ;; f) setact add || exit 1 ; force=True ;; x) setact add || exit 1 ; password="$OPTARG" ;; t) setact toggle || exit 1 ; cronmin="$OPTARG" ;; @@ -357,7 +350,7 @@ esac done case "$action" in list) list ;; - add) checkbasics && askinfo && getboxes && getprofiles && writeinfo && finalize || { delete ; exit 1 ;} ;; + add) checkbasics && askinfo && getboxes && getprofiles && finalize || { delete ; exit 1 ;} ;; delete) delete ;; sync) mailsync $fulladdr ;; toggle) togglecron ;; From 1e7a2fa0d33d27894dfb7d574610855424dba2f7 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 5 Feb 2021 15:22:16 -0500 Subject: [PATCH 112/225] -X to delete local mail when deleting account --- bin/mw | 7 +++++-- mw.1 | 7 +++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/bin/mw b/bin/mw index 23d9e68..58b5f0f 100755 --- a/bin/mw +++ b/bin/mw @@ -169,6 +169,7 @@ delete() { if [ -z "${fulladdr+x}" ]; then sed -ibu "/[0-9]-$fulladdr.muttrc/d" "$muttrc" ; rm -f "$muttrc"bu sed -ibu "/account $fulladdr/,/^\(\s*$\|account\)/d" "$msmtprc"; rm -f "$msmtprc"bu pass rm -f "$fulladdr" >/dev/null 2>&1 + [ -n "${purge+x}" ] && rm -rf "${maildir:?}/${fulladdr:?}" # Get rid of those multiple newlines because I don't know awk well enough to do it by default lol. for file in "$msmtprc" "$mbsyncrc"; do @@ -305,7 +306,8 @@ Options allowed with -a: -S SMTP server port -x Password for account (recommended to be in double quotes) -p Install for a Protonmail account. - -P Add for a POP server instead of IMAP + -P Add for a POP server instead of IMAP. + -X Delete an account's local email too when deleting. -o Configure address, but keep mail online. -f Assume typical English mailboxes without attempting log-on. @@ -316,7 +318,7 @@ To change an account's password, run \`pass edit your@email.com\`. EOF } -while getopts "fpPlhodTYD:y:i:I:s:S:u:a:n:x:m:t:" o; do case "${o}" in +while getopts "fpPXlhodTYD:y:i:I:s:S:u:a:n:x:m:t:" o; do case "${o}" in l) setact list || exit 1 ;; d) setact delete || exit 1 ;; D) setact delete || exit 1 ; fulladdr="$OPTARG" ;; @@ -334,6 +336,7 @@ while getopts "fpPlhodTYD:y:i:I:s:S:u:a:n:x:m:t:" o; do case "${o}" in P) setact add || exit 1 ; type="pop" ;; f) setact add || exit 1 ; force=True ;; x) setact add || exit 1 ; password="$OPTARG" ;; + X) setact delete || exit 1 ; purge=True ;; t) setact toggle || exit 1 ; cronmin="$OPTARG" ;; T) setact toggle || exit 1 ;; p) echo "NOTE: Protonmail users must install and configure Protonmail Bridge first for the first sync to work." diff --git a/mw.1 b/mw.1 index 6e971c2..a9ea0bd 100644 --- a/mw.1 +++ b/mw.1 @@ -79,6 +79,13 @@ connection will still be attempted in setup to discover mailboxes. .TP .B -p Add a Protonmail account. Protonmail Bridge must be installed and set up. +.TP +.B -X +When removing an email profile with either +.I -d +or +.I -D, +also delete the local mail (will not delete the mail on the server). .SH DETAILS .TP .B mailsync From d6d241a5fdab1329f3d7e7b212346d4c336f223c Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 5 Feb 2021 16:25:40 -0500 Subject: [PATCH 113/225] POP support added with mpop. Closes #609 --- README.md | 4 ++++ bin/mw | 26 +++++++++++++++----------- mw.1 | 14 ++++++++++++-- 3 files changed, 31 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 93bbf0a..2aee255 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,7 @@ A user of Arch-based distros can also install the current mutt-wizard release fr - `urlview` - outputs urls in mail to browser. - `cronie` - (or any other major cronjob manager) to set up automatic mail syncing. +- `mpop` - If you want to use POP protocol instead of IMAP. ## Usage @@ -101,6 +102,7 @@ The mutt-wizard runs via the command `mw`. Once setup is complete, you'll use - `-f` -- Assume mailbox names and force account configuration without connecting online at all. - `-o` -- Configure mutt for an account, but do not keep mail offline. +- `-P` -- Use POP protocol instead of IMAP (requires `mpop` installed). ## Neomutt user interface @@ -163,6 +165,8 @@ To give you an example of the interface, here's an idea: - Error handling for the many people who don't read or follow directions. Fewer errors generally. - Addition of a manual `man mw` +- Now handles POP protocol via `mpop` for those who prefer it (add an account + with the `-P` option). POP configs are still generated automatically. ## Help the Project! diff --git a/bin/mw b/bin/mw index 58b5f0f..129cda2 100755 --- a/bin/mw +++ b/bin/mw @@ -27,7 +27,7 @@ checkbasics() { command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2" getaccounts() { accounts="$(find -L "$accdir" -type f 2>/dev/null | grep -o "[0-9]-.*.muttrc" | sed "s/-/: /;s/\.muttrc$//" | sort -n)" ;} -list() { getaccounts && [ -n "$accounts" ] && echo "$accounts" ;} +list() { getaccounts && [ -n "$accounts" ] && echo "$accounts" || exit 1 ;} prepmsmtp() { echo "account $fulladdr host $smtp @@ -72,7 +72,8 @@ ExpireUnread no # End profile " >> "$mbsyncrc" ;} -prepmpop() { echo " +prepmpop() { mkdir -p "${mpoprc%/*}" + echo " account $fulladdr tls on user $login @@ -126,6 +127,7 @@ set ssl_starttls = yes set ssl_force_tls = yes" ;; pop) synccmd="macro index o \"mpop $fulladdr\" \"run mpop to get $fulladdr's mail\"" + folder="$maildir/$fulladdr" prepmpop ;; *) synccmd="macro index o \"mw -y $fulladdr\" \"run mbsync to sync $fulladdr\"" folder="$maildir/$fulladdr" @@ -152,7 +154,7 @@ EOF delete() { if [ -z "${fulladdr+x}" ]; then echo "Select the account your would like to delete (by number):" - list + list || exit 1 read -r input match="^$input:" else @@ -162,18 +164,19 @@ delete() { if [ -z "${fulladdr+x}" ]; then fulladdr="$(echo "$accounts" | grep "$match" | cut -f2 -d' ')" - [ -z "$fulladdr" ] && echo "Invalid account name given." && return 1 + [ -z "$fulladdr" ] && echo "$fulladdr is not a valid account name." && return 1 - sed -ibu "/IMAPStore $fulladdr-remote$/,/# End profile/d" "$mbsyncrc" ; rm -f "$mbsyncrc"bu + sed -ibu "/IMAPStore $fulladdr-remote$/,/# End profile/d" "$mbsyncrc" 2>/dev/null ; rm -f "$mbsyncrc"bu rm -rf "${cachedir:?}/${fulladdr:?}" "$accdir/"[1-9]"-$fulladdr.muttrc" - sed -ibu "/[0-9]-$fulladdr.muttrc/d" "$muttrc" ; rm -f "$muttrc"bu - sed -ibu "/account $fulladdr/,/^\(\s*$\|account\)/d" "$msmtprc"; rm -f "$msmtprc"bu + 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 "$fulladdr" >/dev/null 2>&1 [ -n "${purge+x}" ] && rm -rf "${maildir:?}/${fulladdr:?}" # Get rid of those multiple newlines because I don't know awk well enough to do it by default lol. - for file in "$msmtprc" "$mbsyncrc"; do - tr '\n' '|' < "$file" | sed "s/||\+/||/g" | tr '|' '\n' >> "$file"bu + for file in "$msmtprc" "$mbsyncrc" "$mpoprc"; do + tr '\n' '|' < "$file" 2>/dev/null | sed "s/||\+/||/g" | tr '|' '\n' >> "$file"bu mv -f "$file"bu "$file" done } @@ -217,13 +220,14 @@ macro index,pager C$1 \";=$3\" \"copy mail to $2\"" ;} setBox() { toappend="$toappend set $1 = \"+$2\"" ;} -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 $fulladdr)" --url "${protocol:-imaps}://$imap:${iport:-993}")" [ -z "$info" ] && echo "Log-on not successful." && return 1 mailboxes="$(echo "$info" | grep -v HasChildren | sed "s/.*\" //;s/\"//g" | tr -d ' ')" fi + [ "$type" = "pop" ] && mailboxes="INBOX" getaccounts; for x in $(seq 1 9); do echo "$accounts" | grep -q "^$x:" || { export idnum="$x"; break ;}; done toappend="mailboxes $(echo "$mailboxes" | sed "s/^/\"=/;s/$/\"/" | paste -sd ' ' - )" for x in $mailboxes; do @@ -333,7 +337,7 @@ while getopts "fpPXlhodTYD:y:i:I:s:S:u:a:n:x:m:t:" o; do case "${o}" in n) setact add || exit 1 ; realname="$OPTARG" ;; m) setact add || exit 1 ; maxmes="$OPTARG" ;; o) setact add || exit 1 ; type="online" ;; - P) setact add || exit 1 ; type="pop" ;; + P) setact add || exit 1 ; type="pop"; protocol="pop3s" ; iport="${iport:-995}" ;; f) setact add || exit 1 ; force=True ;; x) setact add || exit 1 ; password="$OPTARG" ;; X) setact delete || exit 1 ; purge=True ;; diff --git a/mw.1 b/mw.1 index a9ea0bd..26d9569 100644 --- a/mw.1 +++ b/mw.1 @@ -54,10 +54,10 @@ Real name which will appear in emails. Should be put in quotes if multiple words Set a maximum number of messages to be stored offline. .TP .B -i -IMAP server address +IMAP/POP server address .TP .B -I -IMAP server port (assumed to be 993 if not specified) +IMAP/POP server port (assumed to be 993 for IMAP and 995 for POP if not specified) .TP .B -s SMTP server address @@ -86,6 +86,15 @@ When removing an email profile with either or .I -D, also delete the local mail (will not delete the mail on the server). +.TP +.B -P +Use POP protocol instead of IMAP. Requires +.I mpop +to download mail after configuration. Server details can still be given with the +.I -i +and +.I -I +options as if it were a IMAP. .SH DETAILS .TP .B mailsync @@ -287,6 +296,7 @@ GPLv3 .BR neomutt (1), .BR neomuttrc (1) .BR mbsync (1), +.BR mpop (1), .BR msmtp (1), .BR notmuch (1), .BR abook (1) From 65b00cc445670ba650be0d45b68d4717e6d57976 Mon Sep 17 00:00:00 2001 From: pryme-svg <65417452+pryme-svg@users.noreply.github.com> Date: Sat, 6 Feb 2021 18:36:28 -0800 Subject: [PATCH 114/225] Update domains.csv --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index fb39143..b33772f 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -196,6 +196,7 @@ opoczta.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465 orange.fr,imap.orange.fr,993,smtp.orange.fr,465 outlook.*,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 outlook.es,outlook.office365.com,993,smtp.office365.com,587 +parabolas.xyz,mail.parabolas.xyz,993,mail.parabolas.xyz,587 paranoici.org,mail.autistici.org,993,smtp.autistici.org,465 paranoid.network,imap.nixnet.email,143,smtp.nixnet.email,587 pm.me,127.0.0.1,1143,127.0.0.1,1025 From 423112a3ab31806f9c6a6c075b9cceaf31139583 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 11 Feb 2021 10:29:44 -0500 Subject: [PATCH 115/225] minor improvement of regex --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mw b/bin/mw index 129cda2..0da655e 100755 --- a/bin/mw +++ b/bin/mw @@ -184,7 +184,7 @@ delete() { if [ -z "${fulladdr+x}" ]; then askinfo() { \ [ -z "$fulladdr" ] && echo "Give the full email address to add:" && read -r fulladdr - while ! echo "$fulladdr" | grep -qE ".+@.+\..+"; do + while ! echo "$fulladdr" | grep -qE "^.+@.+\.[A-z]+$"; do echo "\`$fulladdr\` is not a valid email address. Please retype the address:" read -r fulladdr done From 7413dc6d5ad1fd85e316e49d0492d8e945162a4a Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 11 Feb 2021 11:54:54 -0500 Subject: [PATCH 116/225] since logons check before, delete not nec w/ error --- bin/mw | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/mw b/bin/mw index 0da655e..d869a30 100755 --- a/bin/mw +++ b/bin/mw @@ -153,7 +153,7 @@ EOF } delete() { if [ -z "${fulladdr+x}" ]; then - echo "Select the account your would like to delete (by number):" + echo "Select the account you would like to delete (by number):" list || exit 1 read -r input match="^$input:" @@ -357,7 +357,7 @@ esac done case "$action" in list) list ;; - add) checkbasics && askinfo && getboxes && getprofiles && finalize || { delete ; exit 1 ;} ;; + add) checkbasics && askinfo && getboxes && getprofiles && finalize ;; delete) delete ;; sync) mailsync $fulladdr ;; toggle) togglecron ;; From fff2625e77064e639278bcb611ac11ab7fa03126 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 11 Feb 2021 13:05:02 -0500 Subject: [PATCH 117/225] minor --- bin/mw | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/bin/mw b/bin/mw index d869a30..501f2e3 100755 --- a/bin/mw +++ b/bin/mw @@ -3,7 +3,6 @@ prefix="/usr/local" maildir="${XDG_DATA_HOME:-$HOME/.local/share}/mail" muttshare="$prefix/share/mutt-wizard" -mwconfig="$muttshare/mutt-wizard.muttrc" cachedir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard" muttrc="${XDG_CONFIG_HOME:-$HOME/.config}/mutt/muttrc" accdir="${XDG_CONFIG_HOME:-$HOME/.config}/mutt/accounts" @@ -107,8 +106,8 @@ $synccmd " > "$accdir/$idnum-$fulladdr.muttrc" [ ! -f "$muttrc" ] && echo "# vim: filetype=neomuttrc" > "$muttrc" - ! grep -q "^source.*mutt-wizard.muttrc" "$muttrc" && echo "source $mwconfig" >> "$muttrc" - ! grep "^source.*.muttrc" "$muttrc" | grep -qv "$mwconfig" && echo "source $accdir/$idnum-$fulladdr.muttrc" >> "$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/$idnum-$fulladdr.muttrc" >> "$muttrc" echo "macro index,pager i$idnum 'source $accdir/$idnum-$fulladdr.muttrc!;' \"switch to $fulladdr\"" >> "$muttrc" } @@ -210,7 +209,7 @@ createpass() { echo "$password" > "$PASSWORD_STORE_DIR/$fulladdr" rm -f "$PASSWORD_STORE_DIR/$fulladdr" ;} getpass() { while : ; do pass rm -f "$fulladdr" >/dev/null 2>&1 - pass insert "$fulladdr" && break; done ;} + pass insert -f "$fulladdr" && break; done ;} formatShortcut() { toappend="$toappend macro index,pager g$1 \"=$3\" \"go to $2\" @@ -223,7 +222,7 @@ set $1 = \"+$2\"" ;} 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 $fulladdr)" --url "${protocol:-imaps}://$imap:${iport:-993}")" + info="$(curl --location-trusted -s -m 5 --user "$login:$(pass "$fulladdr")" --url "${protocol:-imaps}://$imap:${iport:-993}")" [ -z "$info" ] && echo "Log-on not successful." && return 1 mailboxes="$(echo "$info" | grep -v HasChildren | sed "s/.*\" //;s/\"//g" | tr -d ' ')" fi From 9ddb824cc0ac8ec886b8a24e7edc94c210485d24 Mon Sep 17 00:00:00 2001 From: Varun Iyer Date: Tue, 23 Feb 2021 09:47:33 -0800 Subject: [PATCH 118/225] Add ucsb.edu to domains.csv --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index b33772f..ed7f666 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -266,6 +266,7 @@ txstate.edu,outlook.office365.com,993,smtp.office365.com,587 ua.pt,outlook.office365.com,993,mail.ua.pt,25 uach.mx,imap.gmail.com,993,smtp.gmail.com,587 ucdavis.edu,imap.gmail.com,993,smtp.gmail.com,587 +ucsb.edu,imap.gmail.com,993,smtp.gmail.com,587 uni-duesseldorf.de,mail.hhu.de,993,mail.hhu.de,465 uni-jena.de,imap.uni-jena.de,993,smtp.uni-jena.de,587 unilodz.eu,outlook.office365.com,993,smtp.office365.com,587 From 747af1cccbfbb99fae3661c49b5ad2ccf3d3c493 Mon Sep 17 00:00:00 2001 From: Kr1ss Date: Thu, 25 Feb 2021 17:23:11 +0100 Subject: [PATCH 119/225] mailsync/notify-send: provide a default `$DISPLAY` A user reports notifications not working on their setup because there is no display id contained in the `ps`/`pgrep` output concerning the Xorg process. This commit checks if there's a display server running at all, and if so it sends notifications even if there's no display id. Resolves https://github.com/LukeSmithxyz/mutt-wizard/issues/661 --- bin/mailsync | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/mailsync b/bin/mailsync index 6741804..ba0a4b5 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -39,12 +39,14 @@ case "$(uname)" in messageinfo() { osascript -e "display notification with title \"📧 $from\" subtitle \"$subject\"" ;} ;; *) - displays="$(pgrep -a X\(org\|wayland\) | grep -wo "[0-9]*:[0-9]\+" | sort -u)" - notify() { for x in $displays; do + # remember if a display server is running since `ps` doesn't always contain a display + pgrepoutput="$(pgrep -a X\(org\|wayland\))" + displays="$(echo "$pgrepoutput" | grep -wo "[0-9]*:[0-9]\+" | sort -u)" + notify() { [ -n "$pgrepoutput" ] && for x in ${displays:-0:}; do export DISPLAY=$x notify-send --app-name="mutt-wizard" "mutt-wizard" "📬 $2 new mail(s) in \`$1\` account." done ;} - messageinfo() { for x in $displays; do + messageinfo() { [ -n "$pgrepoutput" ] && for x in ${displays:-0:}; do export DISPLAY=$x notify-send --app-name="mutt-wizard" "📧$from:" "$subject" done ;} From 4b30e06d05cd6112de84dafb7aa3c2a81b416e88 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 25 Feb 2021 12:21:27 -0500 Subject: [PATCH 120/225] inbox.lv --- FUNDING.yml | 3 +-- share/domains.csv | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/FUNDING.yml b/FUNDING.yml index db8612d..c7c9a22 100644 --- a/FUNDING.yml +++ b/FUNDING.yml @@ -1,3 +1,2 @@ +custom: ["https://lukesmith.xyz/donate.html"] github: lukesmithxyz -custom: ["https://lukesmith.xyz/donate", "https://paypal.me/lukemsmith"] -patreon: lukesmith diff --git a/share/domains.csv b/share/domains.csv index b33772f..a6a6a85 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -124,6 +124,7 @@ hushmail.com,imap.hushmail.com,993,smtp.hushmail.com,465 icloud.com,imap.mail.me.com,993,smtp.mail.me.com,587 illinois.edu, imap.gmail.com,993,smtp.gmail.com,465 in.tum.de,mail.in.tum.de,993,mail.in.tum.de,465 +inbox.lv,mail.inbox.lv,993,mail.inbox.lv,465 iname.com,imap.mail.com,993,smtp.mail.com,587 inf.h-brs.de,imap.inf.h-brs.de,993,smtp.inf.h-brs.de,587 infomaniak.com,imap.infomaniak.com,993,imap.infomaniak.com,587 From 4d411d81798f652fcdfd55d866c4e78f8867a9bc Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 26 Feb 2021 12:37:13 -0500 Subject: [PATCH 121/225] avoid regex issue --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mw b/bin/mw index 501f2e3..111c8d5 100755 --- a/bin/mw +++ b/bin/mw @@ -183,7 +183,7 @@ delete() { if [ -z "${fulladdr+x}" ]; then askinfo() { \ [ -z "$fulladdr" ] && echo "Give the full email address to add:" && read -r fulladdr - while ! echo "$fulladdr" | grep -qE "^.+@.+\.[A-z]+$"; do + while ! echo "$fulladdr" | grep -qE "^.+@.+\.[A-Za-z]+$"; do echo "\`$fulladdr\` is not a valid email address. Please retype the address:" read -r fulladdr done From 2230c4153aaf5301984a94709e0c8dabf9b956a6 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 4 Mar 2021 08:22:52 -0500 Subject: [PATCH 122/225] protonmail smtp, fix #667 --- bin/mw | 5 +++-- share/domains.csv | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/mw b/bin/mw index 111c8d5..2989717 100755 --- a/bin/mw +++ b/bin/mw @@ -34,7 +34,7 @@ port ${sport:-587} from $fulladdr user $login passwordeval \"pass $fulladdr\" -auth on +auth ${auth:-on} ${tlsline:-tls on} tls_trust_file $sslcert logfile $msmtplog @@ -175,7 +175,7 @@ delete() { if [ -z "${fulladdr+x}" ]; then # Get rid of those multiple newlines because I don't know awk well enough to do it by default lol. for file in "$msmtprc" "$mbsyncrc" "$mpoprc"; do - tr '\n' '|' < "$file" 2>/dev/null | sed "s/||\+/||/g" | tr '|' '\n' >> "$file"bu + tr '\n' '|' 2>/dev/null < "$file" | sed "s/||\+/||/g" | tr '|' '\n' >> "$file"bu mv -f "$file"bu "$file" done } @@ -348,6 +348,7 @@ while getopts "fpPXlhodTYD:y:i:I:s:S:u:a:n:x:m:t:" o; do case "${o}" in iport="1143" smtp="127.0.0.1" sport="1025" + auth="login" tlsline="tls_fingerprint $(msmtp --serverinfo --host=$smtp --port=$sport --tls --tls-certcheck=off | awk '/SHA256:/ {print $2}')" setact add || exit 1 ;; diff --git a/share/domains.csv b/share/domains.csv index 6550c34..9fa473c 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -83,8 +83,8 @@ distruzione.org,mail.autistici.org,993,smtp.autistici.org,465 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 -e.email,mail.ecloud.global,993.00,mail.ecloud.global,587.00 -e.email,mail.ecloud.global,993.00,mail.ecloud.global,587.00 +e.email,mail.ecloud.global,993,mail.ecloud.global,587 +e.email,mail.ecloud.global,993,mail.ecloud.global,587 email.arizona.edu,imap.gmail.com,993,smtp.gmail.com,587 email.com,imap.mail.com,993,smtp.mail.com,587 eneco.com,outlook.office365.com,993,smtp.office365.com,587 From 31692fef8a5b0dbf395fb0a0ffe8bb2c802d5935 Mon Sep 17 00:00:00 2001 From: Allen Sobot Date: Sun, 7 Mar 2021 02:00:26 +0100 Subject: [PATCH 123/225] Update UPMC/SU email address configuration These might need STARTTLS explicitly disabled in the msmtp config file though --- share/domains.csv | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/share/domains.csv b/share/domains.csv index 9fa473c..f7ec816 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -92,7 +92,8 @@ engineer.com,imap.mail.com,993,smtp.mail.com,587 erciyes.edu.tr,mail.erciyes.edu.tr,993,mail.erciyes.edu.tr,587 ethancoe.com,mail.privateemail.com,993,mail.privateemail.com,465 ethz.ch,mail.ethz.ch,993,mail.ethz.ch,587 -etu.upmc.fr,courriel.upmc.fr,993,smtps.upmc.fr,587 +etu.sorbonne-universite.fr,imaps.sorbonne-universite.fr,993,smtps.sorbonne-universite.fr,465 +etu.upmc.fr,imaps.sorbonne-universite.fr,993,smtps.sorbonne-universite.fr,465 europe.com,imap.mail.com,993,smtp.mail.com,587 ex-studenti.unitn.it,imap.gmail.com,993,smtp.gmail.com,587 fastmail.com,imap.fastmail.com,993,smtp.fastmail.com,465 From c95428f0f1c02fba4b13a4ec43c70d9e892c52dd Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 11 Mar 2021 17:20:04 -0500 Subject: [PATCH 124/225] compliance with libtard upstream --- bin/mw | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/mw b/bin/mw index 2989717..43bb4d6 100755 --- a/bin/mw +++ b/bin/mw @@ -61,8 +61,8 @@ Inbox ${XDG_DATA_HOME:-$HOME/.local/share}/mail/$fulladdr/${inbox:-INBOX} Channel $fulladdr Expunge Both -Master :$fulladdr-remote: -Slave :$fulladdr-local: +Far :$fulladdr-remote: +Near :$fulladdr-local: Patterns * !\"[Gmail]/All Mail\" Create Both SyncState * From eb291bac7c9745b9bb965ff7a24b4fe37e478ce7 Mon Sep 17 00:00:00 2001 From: Sahid Velji Date: Sat, 13 Mar 2021 12:41:23 -0500 Subject: [PATCH 125/225] Sort and remove duplicate --- share/domains.csv | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/share/domains.csv b/share/domains.csv index f7ec816..5a4208e 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -84,7 +84,6 @@ 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 e.email,mail.ecloud.global,993,mail.ecloud.global,587 -e.email,mail.ecloud.global,993,mail.ecloud.global,587 email.arizona.edu,imap.gmail.com,993,smtp.gmail.com,587 email.com,imap.mail.com,993,smtp.mail.com,587 eneco.com,outlook.office365.com,993,smtp.office365.com,587 @@ -125,8 +124,8 @@ hushmail.com,imap.hushmail.com,993,smtp.hushmail.com,465 icloud.com,imap.mail.me.com,993,smtp.mail.me.com,587 illinois.edu, imap.gmail.com,993,smtp.gmail.com,465 in.tum.de,mail.in.tum.de,993,mail.in.tum.de,465 -inbox.lv,mail.inbox.lv,993,mail.inbox.lv,465 iname.com,imap.mail.com,993,smtp.mail.com,587 +inbox.lv,mail.inbox.lv,993,mail.inbox.lv,465 inf.h-brs.de,imap.inf.h-brs.de,993,smtp.inf.h-brs.de,587 infomaniak.com,imap.infomaniak.com,993,imap.infomaniak.com,587 insiberia.net,mail.autistici.org,993,smtp.autistici.org,465 @@ -225,8 +224,8 @@ rwth-aachen.de,mail.rwth-aachen.de,993,mail.rwth-aachen.de,587 sapo.pt,imap.sapo.pt,993,smtp.sapo.pt,587 seznam.cz,imap.seznam.cz,993,smtp.seznam.cz,465 shu.edu.cn,imap.shu.edu.cn,143,smtp.shu.edu.cn,25 -sina.com,imap.sina.com,993,smtp.sina.com,587 sina.cn,imap.sina.cn,993,smtp.sina.cn,587 +sina.com,imap.sina.com,993,smtp.sina.com,587 smail.inf.h-brs.de,imap.inf.h-brs.de,993,smtp.inf.h-brs.de,587 sms.ed.ac.uk,pod51015.outlook.com,993,pod51015.outlook.com,587 sohu.com,imap.sohu.com,143,smtp.sohu.com,25 @@ -272,9 +271,9 @@ ucsb.edu,imap.gmail.com,993,smtp.gmail.com,587 uni-duesseldorf.de,mail.hhu.de,993,mail.hhu.de,465 uni-jena.de,imap.uni-jena.de,993,smtp.uni-jena.de,587 unilodz.eu,outlook.office365.com,993,smtp.office365.com,587 +unitn.it,imap.gmail.com,993,smtp.gmail.com,587 unitybox.de,mail.unity-mail.de,993,mail.unity-mail.de,587 univ-ubs.fr,partage.univ-ubs.fr,993,partage.univ-ubs.fr,587 -unitn.it,imap.gmail.com,993,smtp.gmail.com,587 uoregon.edu,imap.uoregon.edu,993,smtp.uoregon.edu,587 uqtr.ca,outlook.office365.com,993,smtp.office365.com,587 usa.com,imap.mail.com,993,smtp.mail.com,587 From 995e0680fe758c237a8ca1f1d3afc65d35ec5808 Mon Sep 17 00:00:00 2001 From: Sahid Velji Date: Sat, 13 Mar 2021 12:42:59 -0500 Subject: [PATCH 126/225] Add mail.utoronto.ca and sheridancollege.ca --- share/domains.csv | 2 ++ 1 file changed, 2 insertions(+) diff --git a/share/domains.csv b/share/domains.csv index 5a4208e..d6d1bb2 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -159,6 +159,7 @@ mail.de,imap.mail.de,993,smtp.mail.de,465 mail.mcgill.ca,outlook.office365.com,993,smtp.office365.com,587 mail.polimi.it,outlook.office365.com,993,smtp.office365.com,587 mail.ru,imap.mail.ru,993,smtp.mail.ru,465 +mail.utoronto.ca,outlook.office365.com,993,smtp.office365.com,587 mailbox.org,imap.mailbox.org,993,smtp.mailbox.org,587 mailbox.tu-dresden.de,msx.tu-dresden.de,993,msx.tu-dresden.de,587 mailfence.com,imap.mailfence.com,993,smtp.mailfence.com,465 @@ -223,6 +224,7 @@ runbox.com,mail.runbox.com,993,mail.runbox.com,587 rwth-aachen.de,mail.rwth-aachen.de,993,mail.rwth-aachen.de,587 sapo.pt,imap.sapo.pt,993,smtp.sapo.pt,587 seznam.cz,imap.seznam.cz,993,smtp.seznam.cz,465 +sheridancollege.ca,outlook.office365.com,993,smtp.office365.com,587 shu.edu.cn,imap.shu.edu.cn,143,smtp.shu.edu.cn,25 sina.cn,imap.sina.cn,993,smtp.sina.cn,587 sina.com,imap.sina.com,993,smtp.sina.com,587 From b9b3f7f685e4690a6756102e312172ee0830d016 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Tue, 16 Mar 2021 19:15:32 -0400 Subject: [PATCH 127/225] zshenv checked for variables. fix #677 --- bin/mailsync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mailsync b/bin/mailsync index ba0a4b5..ece503e 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -22,7 +22,7 @@ pgrep -x mbsync >/dev/null && { echo "mbsync is already running." ; exit ;} # will work on the maximum number of machines. eval "$(grep -h -- \ "^\s*\(export \)\?\(MBSYNCRC\|PASSWORD_STORE_DIR\|NOTMUCH_CONFIG\|GNUPGHOME\)=" \ - "$HOME/.profile" "$HOME/.bash_profile" "$HOME/.zprofile" "$HOME/.config/zsh/.zprofile" \ + "$HOME/.profile" "$HOME/.bash_profile" "$HOME/.zprofile" "$HOME/.config/zsh/.zprofile" "$HOME/.zshenv" \ "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.config/zsh/.zshrc" "$HOME/.pam_environment" 2>/dev/null)" case "$(readlink -f /sbin/init)" in From 99af2cf322e9b8c1abddb31fd84bfaedf9dd3280 Mon Sep 17 00:00:00 2001 From: amhlair Date: Wed, 17 Mar 2021 18:51:58 +0000 Subject: [PATCH 128/225] add uni.strath.ac.uk --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index d6d1bb2..9bed584 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -270,6 +270,7 @@ ua.pt,outlook.office365.com,993,mail.ua.pt,25 uach.mx,imap.gmail.com,993,smtp.gmail.com,587 ucdavis.edu,imap.gmail.com,993,smtp.gmail.com,587 ucsb.edu,imap.gmail.com,993,smtp.gmail.com,587 +uni.strath.ac.uk,outlook.office365.com,993,smtp.office365.com,587 uni-duesseldorf.de,mail.hhu.de,993,mail.hhu.de,465 uni-jena.de,imap.uni-jena.de,993,smtp.uni-jena.de,587 unilodz.eu,outlook.office365.com,993,smtp.office365.com,587 From c9419f72b0750bbd205e36dfa0fc64e12cdbad20 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 19 Mar 2021 08:14:09 -0400 Subject: [PATCH 129/225] Revert "compliance with libtard upstream" This reverts commit c95428f0f1c02fba4b13a4ec43c70d9e892c52dd. --- bin/mw | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/mw b/bin/mw index 43bb4d6..2989717 100755 --- a/bin/mw +++ b/bin/mw @@ -61,8 +61,8 @@ Inbox ${XDG_DATA_HOME:-$HOME/.local/share}/mail/$fulladdr/${inbox:-INBOX} Channel $fulladdr Expunge Both -Far :$fulladdr-remote: -Near :$fulladdr-local: +Master :$fulladdr-remote: +Slave :$fulladdr-local: Patterns * !\"[Gmail]/All Mail\" Create Both SyncState * From 48d73d79ddc391158927d0e2dcf0fc56ab388cc5 Mon Sep 17 00:00:00 2001 From: Nicolas Serafini Date: Mon, 22 Mar 2021 11:45:58 +0100 Subject: [PATCH 130/225] add ik.me domain Signed-off-by: Nicolas Serafini --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index 9bed584..75c7763 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -122,6 +122,7 @@ hs-mittweida.de,mail.hs-mittweida.de,993,mail.hs-mittweida.de,465 humbug.pw,imap.migadu.com,993,smtp.migadu.com,587 hushmail.com,imap.hushmail.com,993,smtp.hushmail.com,465 icloud.com,imap.mail.me.com,993,smtp.mail.me.com,587 +ik.me,mail.infomaniak.com,993,mail.infomaniak.com,587 illinois.edu, imap.gmail.com,993,smtp.gmail.com,465 in.tum.de,mail.in.tum.de,993,mail.in.tum.de,465 iname.com,imap.mail.com,993,smtp.mail.com,587 From de58c9869347024219ad883807450741cef71556 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Mon, 22 Mar 2021 21:38:11 -0400 Subject: [PATCH 131/225] no msg --- bin/mailsync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mailsync b/bin/mailsync index ece503e..f61fb80 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -14,7 +14,7 @@ # Run only if user logged in (prevent cron errors) pgrep -u "${USER:=$LOGNAME}" >/dev/null || { echo "$USER not logged in; sync will not run."; exit ;} # Run only if not already running in other instance -pgrep -x mbsync >/dev/null && { echo "mbsync is already running." ; exit ;} +pidof -s mbsync >/dev/null && { echo "mbsync is already running." ; exit ;} # First, we have to get the right variables for the mbsync file, the pass # archive, notmuch and the GPG home. This is done by searching common profile From b5cde63ada77f24703cbba141909ba45d5161a1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Vanzuita?= Date: Fri, 26 Mar 2021 13:34:57 +0100 Subject: [PATCH 132/225] fix: update mbsync call for macos --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mw b/bin/mw index 2989717..54b4a61 100755 --- a/bin/mw +++ b/bin/mw @@ -128,7 +128,7 @@ set ssl_force_tls = yes" pop) synccmd="macro index o \"mpop $fulladdr\" \"run mpop to get $fulladdr's mail\"" folder="$maildir/$fulladdr" prepmpop ;; - *) synccmd="macro index o \"mw -y $fulladdr\" \"run mbsync to sync $fulladdr\"" + *) synccmd="macro index o \"mbsync -a $fulladdr\" \"run mbsync to sync $fulladdr\"" folder="$maildir/$fulladdr" prepmbsync ;; esac From b95d5f2810d518a70ce934d3644aa7e8fde13af3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Vanzuita?= Date: Fri, 26 Mar 2021 20:38:28 +0100 Subject: [PATCH 133/225] chore: typo --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mw b/bin/mw index 54b4a61..2b5563f 100755 --- a/bin/mw +++ b/bin/mw @@ -128,7 +128,7 @@ set ssl_force_tls = yes" pop) synccmd="macro index o \"mpop $fulladdr\" \"run mpop to get $fulladdr's mail\"" folder="$maildir/$fulladdr" prepmpop ;; - *) synccmd="macro index o \"mbsync -a $fulladdr\" \"run mbsync to sync $fulladdr\"" + *) synccmd="macro index o \"mbsync $fulladdr\" \"run mbsync to sync $fulladdr\"" folder="$maildir/$fulladdr" prepmbsync ;; esac From 5e582be7dd1cd8ed91b5150df42577e5ec7ffdd8 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 2 Apr 2021 12:42:56 -0400 Subject: [PATCH 134/225] stave off using unmacro for debian, fix #699 --- bin/mw | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/mw b/bin/mw index 2989717..4ecbcfa 100755 --- a/bin/mw +++ b/bin/mw @@ -101,7 +101,6 @@ bind index gg first-entry unmailboxes * unalternates * unset signature -unmacro index o $synccmd " > "$accdir/$idnum-$fulladdr.muttrc" From bd93f79001ececb539cd0a77a69c5d41138080ed Mon Sep 17 00:00:00 2001 From: "Gunnar K. Halvorsen" Date: Tue, 6 Apr 2021 14:51:39 +0200 Subject: [PATCH 135/225] added new domains --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index 75c7763..622abcf 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -286,6 +286,7 @@ utas.edu.au,outlook.office365.com,993,smtp.office365.com,587 utdallas.edu,outlook.office365.com,993,smtp.office365.com,587 uw.edu,imap.gmail.com,993,smtp.gmail.com,465 uwcad.it,imap.gmail.com,993,smtp.gmail.com,465 +ux.uis.no,imap.ux.uis.no,993,broremann.ux.uis.no,25 uymail.com,imap.mail.com,993,smtp.mail.com,587 vip.onet.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465 vivaldi.net,imap.vivaldi.net,993,smtp.vivaldi.net,587 From 80f10e6e7df3101fae8090d7fe31a72e9361e937 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Tue, 6 Apr 2021 14:31:04 -0400 Subject: [PATCH 136/225] give individual notifications only if < 5 in accordance with #694 --- bin/mailsync | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/bin/mailsync b/bin/mailsync index f61fb80..fab980a 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -59,15 +59,16 @@ syncandnotify() { if [ -z "$opts" ]; then mbsync "$acc"; else mbsync "$opts" "$acc"; fi new=$(find "$HOME/.local/share/mail/$acc/INBOX/new/" "$HOME/.local/share/mail/$acc/Inbox/new/" "$HOME/.local/share/mail/$acc/inbox/new/" -type f -newer "${XDG_CONFIG_HOME:-$HOME/.config}/mutt/.mailsynclastrun" 2> /dev/null) newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l) - if [ "$newcount" -gt "0" ]; then - notify "$acc" "$newcount" & - for file in $new; do - # Extract subject and sender from mail. - from=$(awk '/^From: / && ++n ==1,/^\<.*\>:/' "$file" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | awk '{ $1=""; if (NF>=3)$NF=""; print $0 }' | sed 's/^[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//') - subject=$(awk '/^Subject: / && ++n == 1,/^\<.*\>: / && ++i == 2' "$file" | head -n 1 | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | sed 's/^Subject: //' | sed 's/^{[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//' | tr -d '\n') - messageinfo & - done - fi + case 1 in + $((newcount > 5)) ) notify "$acc" "$newcount" ;; + $((newcount > 0)) ) notify "$acc" "$newcount" + for file in $new; do + # Extract subject and sender from mail. + from=$(awk '/^From: / && ++n ==1,/^\<.*\>:/' "$file" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | awk '{ $1=""; if (NF>=3)$NF=""; print $0 }' | sed 's/^[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//') + subject=$(awk '/^Subject: / && ++n == 1,/^\<.*\>: / && ++i == 2' "$file" | head -n 1 | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | sed 's/^Subject: //' | sed 's/^{[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//' | tr -d '\n') + messageinfo & + done ;; + esac } # Sync accounts passed as argument or all. From fc74631ab8ec477f4da92f770775dcc7c45ca59c Mon Sep 17 00:00:00 2001 From: Fabian Thomas Date: Fri, 9 Apr 2021 00:10:03 +0200 Subject: [PATCH 137/225] add uni-saarland to domains --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index 622abcf..17551ae 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -241,6 +241,7 @@ stud.feec.vutbr.cz,imap.stud.feec.vutbr.cz,993,smtp.stud.feec.vutbr.cz,587 stud.tu-darmstadt.de,imap.stud.tu-darmstadt.de,993,smtp.tu-darmstadt.de,465 stud.uis.no,outlook.office365.com,993,smtp.office365.com,587 stud.uni-bamberg.de,outlook.office365.com,993,smtp.office365.com,587 +stud.uni-saarland.de,mail.hiz-saarland.de,993,mail.hiz-saarland.de,465 student.binadarma.ac.id,imap.gmail.com,993,smtp.gmail.com,587 student.ethz.ch,mail.ethz.ch,993,mail.ethz.ch,587 student.rmit.edu.au,outlook.office365.com,993,smtp.office365.com,587 From afc4722841be5d310a802d5c0d8aa3dfa3fc2b20 Mon Sep 17 00:00:00 2001 From: coreyreichle Date: Fri, 30 Apr 2021 07:41:08 -0400 Subject: [PATCH 138/225] add thunix.net to domains.csv --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index 17551ae..d0fdd3b 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -261,6 +261,7 @@ tecnico.ulisboa.pt,mail.tecnico.ulisboa.pt,993,mail.tecnico.ulisboa.pt,465 teknik.io,mail.teknik.io,993,mail.teknik.io,587 telenet.be,imap.telenet.be,993,smtp.telenet.be,587 tfwno.gf,mail.cock.li,993,mail.cock.li,587 +thunix.net,thunix.net,143,thunix.net,25 tlen.pl,poczta.o2.pl,993,poczta.o2.pl,465 tlu.edu,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 tquad.ai,imap.mail.eu-west-1.awsapps.com,993,smtp.mail.eu-west-1.awsapps.com,465 From 1c4710b38c907c504b18dd9295c2d6f8a30f6f1b Mon Sep 17 00:00:00 2001 From: Inesgor Date: Sun, 2 May 2021 17:14:39 +0530 Subject: [PATCH 139/225] added snopyta.org to domains.csv --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index d0fdd3b..c1bc0d4 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -231,6 +231,7 @@ sina.cn,imap.sina.cn,993,smtp.sina.cn,587 sina.com,imap.sina.com,993,smtp.sina.com,587 smail.inf.h-brs.de,imap.inf.h-brs.de,993,smtp.inf.h-brs.de,587 sms.ed.ac.uk,pod51015.outlook.com,993,pod51015.outlook.com,587 +snopyta.org,mail.snopyta.org,993,mail.snopyta.org,465 sohu.com,imap.sohu.com,143,smtp.sohu.com,25 southwales.ac.uk,imap.gmail.com,993,smtp.gmail.com,587 spoko.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465 From e3dd83a30b797e8fce8d909543095236c49a0fd8 Mon Sep 17 00:00:00 2001 From: Inesgor Date: Sun, 2 May 2021 17:20:49 +0530 Subject: [PATCH 140/225] added dismail.de & paranoid.email to domains.csv --- share/domains.csv | 2 ++ 1 file changed, 2 insertions(+) diff --git a/share/domains.csv b/share/domains.csv index c1bc0d4..b8b0cde 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -78,6 +78,7 @@ deliveryman.com,imap.mail.com,993,smtp.mail.com,587 dicksinhisan.us,mail.cock.li,993,mail.cock.li,587 dicksinmyan.us,mail.cock.li,993,mail.cock.li,587 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 dorriseaton.com,outlook.office365.com,993,smtp.office365.com,587 @@ -202,6 +203,7 @@ outlook.es,outlook.office365.com,993,smtp.office365.com,587 parabolas.xyz,mail.parabolas.xyz,993,mail.parabolas.xyz,587 paranoici.org,mail.autistici.org,993,smtp.autistici.org,465 paranoid.network,imap.nixnet.email,143,smtp.nixnet.email,587 +paranoid.email,imap.paranoid.email,993,smtp.paranoid.email,25 pm.me,127.0.0.1,1143,127.0.0.1,1025 poczta.fm,poczta.interia.pl,993,poczta.interia.pl,465 poczta.onet.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465 From f7c317169f79497f5910f21dfeb181d6616a5be3 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Tue, 4 May 2021 10:45:42 -0400 Subject: [PATCH 141/225] close #705 and avoid loops --- Makefile | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 7b78355..5cd5bf2 100644 --- a/Makefile +++ b/Makefile @@ -10,16 +10,12 @@ endif install: mkdir -p $(DESTDIR)$(PREFIX)/bin - for script in bin/*; do \ - cp -f $$script $(DESTDIR)$(PREFIX)/bin/; \ - chmod 755 $(DESTDIR)$(PREFIX)/$$script; \ - done + cp -f bin/mw bin/mailsync bin/openfile $(DESTDIR)$(PREFIX)/bin/ + chmod 755 $(DESTDIR)$(PREFIX)/bin/mw $(DESTDIR)$(PREFIX)/bin/mailsync $(DESTDIR)$(PREFIX)/bin/openfile mkdir -p $(DESTDIR)$(PREFIX)/share/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 + cp -f share/mailcap share/domains.csv share/mutt-wizard.muttrc $(DESTDIR)$(PREFIX)/share/mutt-wizard + chmod 644 $(DESTDIR)$(PREFIX)/share/mutt-wizard/mailcap $(DESTDIR)$(PREFIX)/share/mutt-wizard/domains.csv $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrc mkdir -p $(DESTDIR)$(MANPREFIX)/man1 cp -f mw.1 $(DESTDIR)$(MANPREFIX)/man1/mw.1 chmod 644 $(DESTDIR)$(MANPREFIX)/man1/mw.1 @@ -33,9 +29,7 @@ install: fi uninstall: - for script in bin/*; do \ - rm -f $(DESTDIR)$(PREFIX)/$$script; \ - done + rm -f $(DESTDIR)$(PREFIX)/bin/mw $(DESTDIR)$(PREFIX)/bin/mailsync $(DESTDIR)$(PREFIX)/bin/openfile rm -rf $(DESTDIR)$(PREFIX)/share/mutt-wizard rm -f $(DESTDIR)$(MANPREFIX)/man1/mw.1 From 243fca2b9c358b086cc70fe186b25410d9d70f57 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Tue, 4 May 2021 10:46:47 -0400 Subject: [PATCH 142/225] don't state mail number if small --- bin/mailsync | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bin/mailsync b/bin/mailsync index fab980a..af7aa6c 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -61,8 +61,7 @@ syncandnotify() { newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l) case 1 in $((newcount > 5)) ) notify "$acc" "$newcount" ;; - $((newcount > 0)) ) notify "$acc" "$newcount" - for file in $new; do + $((newcount > 0)) ) for file in $new; do # Extract subject and sender from mail. from=$(awk '/^From: / && ++n ==1,/^\<.*\>:/' "$file" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | awk '{ $1=""; if (NF>=3)$NF=""; print $0 }' | sed 's/^[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//') subject=$(awk '/^Subject: / && ++n == 1,/^\<.*\>: / && ++i == 2' "$file" | head -n 1 | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | sed 's/^Subject: //' | sed 's/^{[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//' | tr -d '\n') From 39cc3a7e37a832ab3ff092eb3f7d9b710fdbbcb7 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Tue, 4 May 2021 10:48:37 -0400 Subject: [PATCH 143/225] fix #713, don't detect non-inbox as inbox --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mw b/bin/mw index 4ecbcfa..0c31c00 100755 --- a/bin/mw +++ b/bin/mw @@ -236,7 +236,7 @@ getboxes() { if [ -n "${force+x}" ] ; then *[Jj][Uu][Nn][Kk]*) formatShortcut j junk "$x" ;; *[Aa][Rr][Cc][Hh][Ii][Vv][Ee]*) formatShortcut a archive "$x" ;; *[Ss][Pp][Aa][Mm]*) formatShortcut S spam "$x" ;; - *[Ii][Nn][Bb][Oo][Xx]*) formatShortcut i inbox "$x"; setBox spoolfile "$x" inbox="$x" ;; + *[Ii][Nn][Bb][Oo][Xx]) formatShortcut i inbox "$x"; setBox spoolfile "$x" inbox="$x" ;; esac done } From eec5c1dd5e9920c1729c8b7a4069f286d4cd3469 Mon Sep 17 00:00:00 2001 From: Sean Breckenridge Date: Sun, 9 May 2021 17:07:20 -0700 Subject: [PATCH 144/225] update domain list add mac alternative domains (@mac.com/@me.com) these are legacy domains that mac used to use which have been merged into icloud for more info see: https://support.apple.com/en-us/HT201771 https://getmailspring.com/setup/access-mac-com-via-imap-smtp also add ucsc.edu, which like the other uc's uses google --- share/domains.csv | 3 +++ 1 file changed, 3 insertions(+) diff --git a/share/domains.csv b/share/domains.csv index b8b0cde..c72e713 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -156,6 +156,7 @@ loves.dicksinhisan.us,mail.cock.li,993,mail.cock.li,587 loves.dicksinmyan.us,mail.cock.li,993,mail.cock.li,587 lukesmith.xyz,mail.lukesmith.xyz,993,mail.lukesmith.xyz,587 luther.edu,imap.gmail.com,993,smtp.gmail.com,587 +mac.com,imap.mail.me.com,993,smtp.mail.me.com,587 mail.com,imap.mail.com,993,smtp.mail.com,587 mail.de,imap.mail.de,993,smtp.mail.de,465 mail.mcgill.ca,outlook.office365.com,993,smtp.office365.com,587 @@ -167,6 +168,7 @@ mailbox.tu-dresden.de,msx.tu-dresden.de,993,msx.tu-dresden.de,587 mailfence.com,imap.mailfence.com,993,smtp.mailfence.com,465 mailo.com,mail.mailo.com,993,mail.mailo.com,465 marquette.edu,outlook.office365.com,993,smtp.office365.com,587 +me.com,imap.mail.me.com,993,smtp.mail.me.com,587 memeware.net,mail.cock.li,993,mail.cock.li,587 metu.edu.tr,imap.metu.edu.tr,993,smtp.metu.edu.tr,465 mit.edu,imap.exchange.mit.edu,993,outgoing.mit.edu,465 @@ -276,6 +278,7 @@ ua.pt,outlook.office365.com,993,mail.ua.pt,25 uach.mx,imap.gmail.com,993,smtp.gmail.com,587 ucdavis.edu,imap.gmail.com,993,smtp.gmail.com,587 ucsb.edu,imap.gmail.com,993,smtp.gmail.com,587 +ucsc.edu,imap.gmail.com,993,smtp.gmail.com,587 uni.strath.ac.uk,outlook.office365.com,993,smtp.office365.com,587 uni-duesseldorf.de,mail.hhu.de,993,mail.hhu.de,465 uni-jena.de,imap.uni-jena.de,993,smtp.uni-jena.de,587 From 2cb2fa03452cb99537a1751961574a0b6d3253e0 Mon Sep 17 00:00:00 2001 From: Aisha Tammy Date: Sat, 15 May 2021 22:16:15 -0400 Subject: [PATCH 145/225] allow dynamically loading available mailboxes this way if a folder is added or deleted in the remote location, and gets deleted after sync, it is reflected in the next opening Signed-off-by: Aisha Tammy --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mw b/bin/mw index 54af276..ebd0fdb 100755 --- a/bin/mw +++ b/bin/mw @@ -227,7 +227,7 @@ getboxes() { if [ -n "${force+x}" ] ; then fi [ "$type" = "pop" ] && mailboxes="INBOX" getaccounts; for x in $(seq 1 9); do echo "$accounts" | grep -q "^$x:" || { export idnum="$x"; break ;}; done - toappend="mailboxes $(echo "$mailboxes" | sed "s/^/\"=/;s/$/\"/" | paste -sd ' ' - )" + toappend="mailboxes \`mdir=$maildir/$fulladdr/; find \$mdir -type d -name cur | sort | sed -e 's:/cur\$:\":' -e \"s:\$mdir:\\\"=:\" | tr '\\\n' ' '\`" for x in $mailboxes; do case "$x" in *[Ss][Ee][Nn][Tt]*) setBox record "$x"; formatShortcut s sent "$x" ;; From 2a50561834c23565bd5587972dff5cc9de53dd57 Mon Sep 17 00:00:00 2001 From: Aisha Tammy Date: Wed, 19 May 2021 18:57:43 -0400 Subject: [PATCH 146/225] set mindepth to 1 and move sort to after sed Signed-off-by: Aisha Tammy --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mw b/bin/mw index ebd0fdb..3cc3d78 100755 --- a/bin/mw +++ b/bin/mw @@ -227,7 +227,7 @@ getboxes() { if [ -n "${force+x}" ] ; then fi [ "$type" = "pop" ] && mailboxes="INBOX" getaccounts; for x in $(seq 1 9); do echo "$accounts" | grep -q "^$x:" || { export idnum="$x"; break ;}; done - toappend="mailboxes \`mdir=$maildir/$fulladdr/; find \$mdir -type d -name cur | sort | sed -e 's:/cur\$:\":' -e \"s:\$mdir:\\\"=:\" | tr '\\\n' ' '\`" + toappend="mailboxes \`mdir=$maildir/$fulladdr/; find \$mdir -mindepth 1 -type d -name cur | sed -e 's:/cur\$:\":' -e \"s:\$mdir:\\\"=:\" | sort | tr '\\\n' ' '\`" for x in $mailboxes; do case "$x" in *[Ss][Ee][Nn][Tt]*) setBox record "$x"; formatShortcut s sent "$x" ;; From 8c71c10b0a8066cf0dc6bc5e0c5583eaddbb5441 Mon Sep 17 00:00:00 2001 From: pierre Date: Tue, 25 May 2021 16:05:16 -0400 Subject: [PATCH 147/225] password store with multiple private keys fix --- bin/mw | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bin/mw b/bin/mw index 54af276..92e539c 100755 --- a/bin/mw +++ b/bin/mw @@ -18,8 +18,7 @@ done || { echo "CA Certificate not found. Please install one or link it to /etc/ 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" ] && - "$GPG" --list-secret-keys "$(cat "$PASSWORD_STORE_DIR/.gpg-id")" >/dev/null 2>&1 || { + [ -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 ;} ;} @@ -204,7 +203,7 @@ askinfo() { \ } createpass() { echo "$password" > "$PASSWORD_STORE_DIR/$fulladdr" - "$GPG" -qer "$(cat "$PASSWORD_STORE_DIR/.gpg-id")" "$PASSWORD_STORE_DIR/$fulladdr" + "$GPG" -qe $(printf -- " -r %s" $(cat "$PASSWORD_STORE_DIR/.gpg-id")) "$PASSWORD_STORE_DIR/$fulladdr" rm -f "$PASSWORD_STORE_DIR/$fulladdr" ;} getpass() { while : ; do pass rm -f "$fulladdr" >/dev/null 2>&1 From 36788d9c439729f97edda2aba75bf477f029dca2 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sun, 30 May 2021 21:21:31 -0400 Subject: [PATCH 148/225] don't readlink for soystemd on mac --- bin/mailsync | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/mailsync b/bin/mailsync index af7aa6c..f739584 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -25,9 +25,6 @@ eval "$(grep -h -- \ "$HOME/.profile" "$HOME/.bash_profile" "$HOME/.zprofile" "$HOME/.config/zsh/.zprofile" "$HOME/.zshenv" \ "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.config/zsh/.zshrc" "$HOME/.pam_environment" 2>/dev/null)" -case "$(readlink -f /sbin/init)" in - *systemd*) export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus ;; -esac export GPG_TTY=$TTY [ -n "$MBSYNCRC" ] && alias mbsync="mbsync -c $MBSYNCRC" || MBSYNCRC="$HOME/.mbsyncrc" @@ -39,6 +36,9 @@ case "$(uname)" in messageinfo() { osascript -e "display notification with title \"📧 $from\" subtitle \"$subject\"" ;} ;; *) + case "$(readlink -f /sbin/init)" in + *systemd*) export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus ;; + esac # remember if a display server is running since `ps` doesn't always contain a display pgrepoutput="$(pgrep -a X\(org\|wayland\))" displays="$(echo "$pgrepoutput" | grep -wo "[0-9]*:[0-9]\+" | sort -u)" From b9a95a055a5737c7765c2d21451d504c9818ba80 Mon Sep 17 00:00:00 2001 From: Kr1ss Date: Tue, 15 Jun 2021 20:14:18 +0200 Subject: [PATCH 149/225] patch mailsync on macOS; fixes #725 The macOS version of `pidof` doesn't implement the `-s` flag. --- bin/mailsync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mailsync b/bin/mailsync index f739584..a026354 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -14,7 +14,7 @@ # Run only if user logged in (prevent cron errors) pgrep -u "${USER:=$LOGNAME}" >/dev/null || { echo "$USER not logged in; sync will not run."; exit ;} # Run only if not already running in other instance -pidof -s mbsync >/dev/null && { echo "mbsync is already running." ; exit ;} +pidof $([ $(uname) != Darwin ] && echo '-s') mbsync >/dev/null && { echo "mbsync is already running."; exit ;} # First, we have to get the right variables for the mbsync file, the pass # archive, notmuch and the GPG home. This is done by searching common profile From b0452a39d5b573a9a12da0064c0341846ba8ff5d Mon Sep 17 00:00:00 2001 From: Kr1ss Date: Tue, 15 Jun 2021 22:08:30 +0200 Subject: [PATCH 150/225] remove `pidof -s` flag Ref: https://github.com/LukeSmithxyz/mutt-wizard/commit/b9a95a055a5737c7765c2d21451d504c9818ba80#commitcomment-52203708 --- bin/mailsync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mailsync b/bin/mailsync index a026354..f00baf1 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -14,7 +14,7 @@ # Run only if user logged in (prevent cron errors) pgrep -u "${USER:=$LOGNAME}" >/dev/null || { echo "$USER not logged in; sync will not run."; exit ;} # Run only if not already running in other instance -pidof $([ $(uname) != Darwin ] && echo '-s') mbsync >/dev/null && { echo "mbsync is already running."; exit ;} +pidof mbsync >/dev/null && { echo "mbsync is already running."; exit ;} # First, we have to get the right variables for the mbsync file, the pass # archive, notmuch and the GPG home. This is done by searching common profile From f92000e5ed8d393de8f02093afebdb5ab69a1861 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Mon, 28 Jun 2021 10:25:41 -0400 Subject: [PATCH 151/225] fix #730, sed only nl removal with error sup --- bin/mw | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bin/mw b/bin/mw index 54af276..d960b7b 100755 --- a/bin/mw +++ b/bin/mw @@ -172,10 +172,8 @@ delete() { if [ -z "${fulladdr+x}" ]; then pass rm -f "$fulladdr" >/dev/null 2>&1 [ -n "${purge+x}" ] && rm -rf "${maildir:?}/${fulladdr:?}" - # Get rid of those multiple newlines because I don't know awk well enough to do it by default lol. for file in "$msmtprc" "$mbsyncrc" "$mpoprc"; do - tr '\n' '|' 2>/dev/null < "$file" | sed "s/||\+/||/g" | tr '|' '\n' >> "$file"bu - mv -f "$file"bu "$file" + sed -ibu 'N;/^\n$/D;P;D;' "$file" 2>/dev/null; rm -f "$file"bu done } From 8171e6327c2c1b4088da441ced4186d0934bc888 Mon Sep 17 00:00:00 2001 From: phire Date: Thu, 8 Jul 2021 01:38:41 +0200 Subject: [PATCH 152/225] Set hostname variable --- bin/mw | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/mw b/bin/mw index d960b7b..0fd01d8 100755 --- a/bin/mw +++ b/bin/mw @@ -91,6 +91,7 @@ set folder = \"$folder\" set header_cache = $cachedir/$fulladdr/headers set message_cachedir = $cachedir/$fulladdr/bodies set mbox_type = Maildir +set hostname = \"$hostname\" $extra bind index,pager gg noop @@ -193,6 +194,7 @@ askinfo() { \ read -r smtp [ "$sport" = 465 ] && tlsline="tls_starttls off" [ -z "$realname" ] && realname="${fulladdr%%@*}" + hostname="$(echo "$fulladdr" | cut -d @ -f 2)" login="${login:-$fulladdr}" if [ -n "${password+x}" ]; then createpass From 8dd99232806ad038bb060e71354d1a861d74f3b0 Mon Sep 17 00:00:00 2001 From: Sean Brar <69971174+seanbrar@users.noreply.github.com> Date: Fri, 9 Jul 2021 04:49:41 -0700 Subject: [PATCH 153/225] Add calstatela.edu to domains.csv --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index c72e713..f0d8399 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -43,6 +43,7 @@ bocken.org,mail.bocken.org,993,mail.bocken.org,587 brew-meister.com,imap.mail.com,993,smtp.mail.com,587 bruttocarattere.org,mail.autistici.org,993,smtp.autistici.org,465 btinternet.com,mail.btinternet.com,993,mail.btinternet.com,587 +calstatela.edu,outlook.office365.com,993,smtp.office365.com,587 canaglie.net,mail.autistici.org,993,smtp.autistici.org,465 canaglie.org,mail.autistici.org,993,smtp.autistici.org,465 carleton.ca,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 From b8736f6a8582ae6d2f1467f6bec19dab3e929573 Mon Sep 17 00:00:00 2001 From: 3nt3 Date: Wed, 4 Aug 2021 23:29:00 +0200 Subject: [PATCH 154/225] update domains.csv to add 3nt3.de --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index c72e713..e8cce57 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -317,3 +317,4 @@ zaclys.net,mail.zaclys.net,993,mail.zaclys.net,465 zju.edu.cn,imap.zju.edu.cn,993,smtp.zju.edu.cn,994 zoho.com,imap.zoho.com,993,smtp.zoho.com,465 zohomail.eu,imap.zoho.eu,993,smtp.zoho.eu,465 +3nt3.de,mail.3nt3.de,993,mail.3nt3.de,465 From 8e5bb8bd095aaf9cb42997c243c4d4dc47f588a9 Mon Sep 17 00:00:00 2001 From: ananthu Date: Sat, 7 Aug 2021 14:14:15 +0530 Subject: [PATCH 155/225] bug; argument getting splitted by space --- bin/mw | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/mw b/bin/mw index 0fd01d8..2e38cde 100755 --- a/bin/mw +++ b/bin/mw @@ -228,6 +228,7 @@ getboxes() { if [ -n "${force+x}" ] ; then [ "$type" = "pop" ] && mailboxes="INBOX" getaccounts; for x in $(seq 1 9); do echo "$accounts" | grep -q "^$x:" || { export idnum="$x"; break ;}; done toappend="mailboxes $(echo "$mailboxes" | sed "s/^/\"=/;s/$/\"/" | paste -sd ' ' - )" + IFS=$'\n' for x in $mailboxes; do case "$x" in *[Ss][Ee][Nn][Tt]*) setBox record "$x"; formatShortcut s sent "$x" ;; @@ -239,6 +240,7 @@ getboxes() { if [ -n "${force+x}" ] ; then *[Ii][Nn][Bb][Oo][Xx]) formatShortcut i inbox "$x"; setBox spoolfile "$x" inbox="$x" ;; esac done + unset IFS } finalize() { echo "$toappend" >> "$accdir/$idnum-$fulladdr.muttrc" From 852cacce7a77630bc4b8c8a2ef0ce6b3f5de44a0 Mon Sep 17 00:00:00 2001 From: ananthu Date: Sat, 7 Aug 2021 14:14:51 +0530 Subject: [PATCH 156/225] enhancement; added college domain --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index e8cce57..a7135bd 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -157,6 +157,7 @@ loves.dicksinmyan.us,mail.cock.li,993,mail.cock.li,587 lukesmith.xyz,mail.lukesmith.xyz,993,mail.lukesmith.xyz,587 luther.edu,imap.gmail.com,993,smtp.gmail.com,587 mac.com,imap.mail.me.com,993,smtp.mail.me.com,587 +mace.ac.in,imap.gmail.com,993,smtp.gmail.com,465 mail.com,imap.mail.com,993,smtp.mail.com,587 mail.de,imap.mail.de,993,smtp.mail.de,465 mail.mcgill.ca,outlook.office365.com,993,smtp.office365.com,587 From 99c0466a3495a6b064b84ed47f15919f10650ee2 Mon Sep 17 00:00:00 2001 From: Ananthu Date: Sat, 7 Aug 2021 14:40:28 +0530 Subject: [PATCH 157/225] enhancement; college domain smtp port change --- share/domains.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/domains.csv b/share/domains.csv index a7135bd..618ee09 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -157,7 +157,7 @@ loves.dicksinmyan.us,mail.cock.li,993,mail.cock.li,587 lukesmith.xyz,mail.lukesmith.xyz,993,mail.lukesmith.xyz,587 luther.edu,imap.gmail.com,993,smtp.gmail.com,587 mac.com,imap.mail.me.com,993,smtp.mail.me.com,587 -mace.ac.in,imap.gmail.com,993,smtp.gmail.com,465 +mace.ac.in,imap.gmail.com,993,smtp.gmail.com,587 mail.com,imap.mail.com,993,smtp.mail.com,587 mail.de,imap.mail.de,993,smtp.mail.de,465 mail.mcgill.ca,outlook.office365.com,993,smtp.office365.com,587 From 8239a7d5ca6807d395f787c8c940a08301eb61d7 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Mon, 9 Aug 2021 20:52:19 -0400 Subject: [PATCH 158/225] remove bashism, fix #752 --- bin/mw | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/mw b/bin/mw index 2e38cde..41977b1 100755 --- a/bin/mw +++ b/bin/mw @@ -182,7 +182,7 @@ askinfo() { \ [ -z "$fulladdr" ] && echo "Give the full email address to add:" && read -r fulladdr while ! echo "$fulladdr" | grep -qE "^.+@.+\.[A-Za-z]+$"; do - echo "\`$fulladdr\` is not a valid email address. Please retype the address:" + echo "$fulladdr is not a valid email address. Please retype the address:" read -r fulladdr done getaccounts; echo "$accounts" | grep -q "\s$fulladdr$" 2>/dev/null && @@ -228,7 +228,8 @@ getboxes() { if [ -n "${force+x}" ] ; then [ "$type" = "pop" ] && mailboxes="INBOX" getaccounts; for x in $(seq 1 9); do echo "$accounts" | grep -q "^$x:" || { export idnum="$x"; break ;}; done toappend="mailboxes $(echo "$mailboxes" | sed "s/^/\"=/;s/$/\"/" | paste -sd ' ' - )" - IFS=$'\n' + IFS=' +' for x in $mailboxes; do case "$x" in *[Ss][Ee][Nn][Tt]*) setBox record "$x"; formatShortcut s sent "$x" ;; From d2942f2d22f4090fa3abc8d1f8eb2377fac0a7ba Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 13 Aug 2021 14:19:05 -0400 Subject: [PATCH 159/225] sort --- share/domains.csv | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/share/domains.csv b/share/domains.csv index 618ee09..6b23434 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -1,6 +1,7 @@ ADDRESS,IMAP,imap port,SMTP,smtp port 126.com,imap.126.com,993,smtp.126.com,587 163.com,imap.163.com,993,smtp.163.com,587 +3nt3.de,mail.3nt3.de,993,mail.3nt3.de,465 420blaze.it,mail.cock.li,993,mail.cock.li,587 8chan.co,mail.cock.li,993,mail.cock.li,587 aaathats3as.com,mail.cock.li,993,mail.cock.li,587 @@ -205,8 +206,8 @@ outlook.*,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 outlook.es,outlook.office365.com,993,smtp.office365.com,587 parabolas.xyz,mail.parabolas.xyz,993,mail.parabolas.xyz,587 paranoici.org,mail.autistici.org,993,smtp.autistici.org,465 -paranoid.network,imap.nixnet.email,143,smtp.nixnet.email,587 paranoid.email,imap.paranoid.email,993,smtp.paranoid.email,25 +paranoid.network,imap.nixnet.email,143,smtp.nixnet.email,587 pm.me,127.0.0.1,1143,127.0.0.1,1025 poczta.fm,poczta.interia.pl,993,poczta.interia.pl,465 poczta.onet.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465 @@ -280,9 +281,9 @@ uach.mx,imap.gmail.com,993,smtp.gmail.com,587 ucdavis.edu,imap.gmail.com,993,smtp.gmail.com,587 ucsb.edu,imap.gmail.com,993,smtp.gmail.com,587 ucsc.edu,imap.gmail.com,993,smtp.gmail.com,587 -uni.strath.ac.uk,outlook.office365.com,993,smtp.office365.com,587 uni-duesseldorf.de,mail.hhu.de,993,mail.hhu.de,465 uni-jena.de,imap.uni-jena.de,993,smtp.uni-jena.de,587 +uni.strath.ac.uk,outlook.office365.com,993,smtp.office365.com,587 unilodz.eu,outlook.office365.com,993,smtp.office365.com,587 unitn.it,imap.gmail.com,993,smtp.gmail.com,587 unitybox.de,mail.unity-mail.de,993,mail.unity-mail.de,587 @@ -318,4 +319,3 @@ zaclys.net,mail.zaclys.net,993,mail.zaclys.net,465 zju.edu.cn,imap.zju.edu.cn,993,smtp.zju.edu.cn,994 zoho.com,imap.zoho.com,993,smtp.zoho.com,465 zohomail.eu,imap.zoho.eu,993,smtp.zoho.eu,465 -3nt3.de,mail.3nt3.de,993,mail.3nt3.de,465 From fb68f19846141df5ff5c6b8c4f15f589b0f5000f Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sat, 14 Aug 2021 18:50:33 -0400 Subject: [PATCH 160/225] use soyterms if not slower distro --- bin/mw | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/bin/mw b/bin/mw index 41977b1..87ec79c 100755 --- a/bin/mw +++ b/bin/mw @@ -12,7 +12,18 @@ mbsyncrc="${MBSYNCRC:-$HOME/.mbsyncrc}" mpoprc="${XDG_CONFIG_HOME:-$HOME/.config}/mpop/config" alias mbsync='mbsync -c "$mbsyncrc"' -for x in "/etc/ssl/certs/ca-certificates.crt" "/etc/pki/tls/certs/ca-bundle.crt" "/etc/ssl/ca-bundle.pem" "/etc/pki/tls/cacert.pem" "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem" "/etc/ssl/cert.pem" "/usr/local/share/ca-certificates/"; do +# On Ubuntu/Debian, a link is needed since they use an older version. +if command -V apt-get >/dev/null 2>&1; then + ln -s "$msmtprc" "$HOME/.msmtprc" 2>/dev/null + master="Master" + slave="Slave" +fi + +for x in "/etc/ssl/certs/ca-certificates.crt" \ + "/etc/pki/tls/certs/ca-bundle.crt" "/etc/ssl/cert.pem" \ + "/etc/ssl/ca-bundle.pem" "/etc/pki/tls/cacert.pem" \ + "/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 ;} @@ -39,8 +50,6 @@ ${tlsline:-tls on} tls_trust_file $sslcert logfile $msmtplog " >> "$msmtprc" - # On Ubuntu/Debian, a link is needed since they use an older version. - command -V apt-get >/dev/null 2>&1 && ln -s "$msmtprc" "$HOME/.msmtprc" 2>/dev/null } prepmbsync() { mkdir -p "${mbsyncrc%/*}" @@ -61,8 +70,8 @@ Inbox ${XDG_DATA_HOME:-$HOME/.local/share}/mail/$fulladdr/${inbox:-INBOX} Channel $fulladdr Expunge Both -Master :$fulladdr-remote: -Slave :$fulladdr-local: +${master:-Far} :$fulladdr-remote: +${slave:-Near} :$fulladdr-local: Patterns * !\"[Gmail]/All Mail\" Create Both SyncState * From 3ef2b112459ce7101a6ee881cb478ff68647871e Mon Sep 17 00:00:00 2001 From: Hudson Finn Date: Mon, 16 Aug 2021 19:54:23 -0400 Subject: [PATCH 161/225] Update domains.csv --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index 6b23434..0cb7026 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -1,4 +1,5 @@ ADDRESS,IMAP,imap port,SMTP,smtp port +gordon.edu,outlook.office365.com,993,smtp.office365.com,587 126.com,imap.126.com,993,smtp.126.com,587 163.com,imap.163.com,993,smtp.163.com,587 3nt3.de,mail.3nt3.de,993,mail.3nt3.de,465 From 2ef58a8e432a6668bac825adfa742c57cb97a942 Mon Sep 17 00:00:00 2001 From: Benjamin-Davies Date: Mon, 23 Aug 2021 17:36:20 +1200 Subject: [PATCH 162/225] Add uclive.ac.nz domains Add domains for uclive.ac.nz addresses. These are undergrad (and maybe other) addresses for the University of Canterbury (https://canterbury.ac.nz/). --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index 292e05c..8ad855d 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -281,6 +281,7 @@ txstate.edu,outlook.office365.com,993,smtp.office365.com,587 ua.pt,outlook.office365.com,993,mail.ua.pt,25 uach.mx,imap.gmail.com,993,smtp.gmail.com,587 ucdavis.edu,imap.gmail.com,993,smtp.gmail.com,587 +uclive.ac.nz,outlook.office365.com,993,smtp.office365.com,587 ucsb.edu,imap.gmail.com,993,smtp.gmail.com,587 ucsc.edu,imap.gmail.com,993,smtp.gmail.com,587 uni-duesseldorf.de,mail.hhu.de,993,mail.hhu.de,465 From bd8551163ead2720fd3d3579f64f8816521be11c Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 27 Aug 2021 19:05:55 -0400 Subject: [PATCH 163/225] fix for 465 starttls --- bin/mw | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/mw b/bin/mw index 87ec79c..fbf2884 100755 --- a/bin/mw +++ b/bin/mw @@ -46,9 +46,10 @@ from $fulladdr user $login passwordeval \"pass $fulladdr\" auth ${auth:-on} -${tlsline:-tls on} +tls on tls_trust_file $sslcert logfile $msmtplog +$tlsline " >> "$msmtprc" } From 20e08b07fd2df0afc066df9d3d252ac94374e824 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 27 Aug 2021 19:06:29 -0400 Subject: [PATCH 164/225] sort --- share/domains.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/domains.csv b/share/domains.csv index 292e05c..2ec18f1 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -1,5 +1,4 @@ ADDRESS,IMAP,imap port,SMTP,smtp port -gordon.edu,outlook.office365.com,993,smtp.office365.com,587 126.com,imap.126.com,993,smtp.126.com,587 163.com,imap.163.com,993,smtp.163.com,587 3nt3.de,mail.3nt3.de,993,mail.3nt3.de,465 @@ -114,6 +113,7 @@ gmx.*,imap.gmx.net,993,mail.gmx.net,587 go2.pl,poczta.o2.pl,993,poczta.o2.pl,465 goat.si,mail.cock.li,993,mail.cock.li,587 googlemail.com,imap.googlemail.com,993,smtp.googlemail.com,587 +gordon.edu,outlook.office365.com,993,smtp.office365.com,587 grrlz.net,mail.autistici.org,993,smtp.autistici.org,465 hacari.*,mail.autistici.org,993,smtp.autistici.org,465 helsinki.fi,outlook.office365.com,993,smtp.helsinki.fi,587 From 2be8ea7871e6d07592d7b4ed85ace213774261f6 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sun, 29 Aug 2021 14:36:26 -0400 Subject: [PATCH 165/225] not necessary to create cachedir manually --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mw b/bin/mw index 823730e..e63fff2 100755 --- a/bin/mw +++ b/bin/mw @@ -121,7 +121,7 @@ $synccmd } getprofiles() { \ - mkdir -p "${muttrc%/*}" "$accdir" "$cachedir/$fulladdr/bodies" "${XDG_CONFIG_HOME:-$HOME/.config}/msmtp" + mkdir -p "${muttrc%/*}" "$accdir" "${XDG_CONFIG_HOME:-$HOME/.config}/msmtp" unset msmtp_header msmtp_profile mutt_profile mbsync_profile case "$iport" in 1143) imapssl=None ;; From 5971fadec832e6b970e7911e1919432c6052fdc7 Mon Sep 17 00:00:00 2001 From: Horea Christian Date: Thu, 9 Sep 2021 19:04:18 -0400 Subject: [PATCH 166/225] Check both new and cur dirs for notification Also better formattin --- bin/mailsync | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/mailsync b/bin/mailsync index f00baf1..a633308 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -57,7 +57,14 @@ esac syncandnotify() { acc="$(echo "$account" | sed "s/.*\///")" if [ -z "$opts" ]; then mbsync "$acc"; else mbsync "$opts" "$acc"; fi - new=$(find "$HOME/.local/share/mail/$acc/INBOX/new/" "$HOME/.local/share/mail/$acc/Inbox/new/" "$HOME/.local/share/mail/$acc/inbox/new/" -type f -newer "${XDG_CONFIG_HOME:-$HOME/.config}/mutt/.mailsynclastrun" 2> /dev/null) + new=$(find\ + "$HOME/.local/share/mail/$acc/INBOX/new/"\ + "$HOME/.local/share/mail/$acc/Inbox/new/"\ + "$HOME/.local/share/mail/$acc/inbox/new/"\ + "$HOME/.local/share/mail/$acc/INBOX/cur/"\ + "$HOME/.local/share/mail/$acc/Inbox/cur/"\ + "$HOME/.local/share/mail/$acc/inbox/cur/"\ + -type f -newer "${XDG_CONFIG_HOME:-$HOME/.config}/mutt/.mailsynclastrun" 2> /dev/null) newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l) case 1 in $((newcount > 5)) ) notify "$acc" "$newcount" ;; From f845e11fe281dd144311ff619cf16388a0f636e3 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 16 Sep 2021 15:07:47 -0400 Subject: [PATCH 167/225] fix #745, avoid incompatibility --- bin/mailsync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mailsync b/bin/mailsync index a633308..4469d55 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -25,7 +25,7 @@ eval "$(grep -h -- \ "$HOME/.profile" "$HOME/.bash_profile" "$HOME/.zprofile" "$HOME/.config/zsh/.zprofile" "$HOME/.zshenv" \ "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.config/zsh/.zshrc" "$HOME/.pam_environment" 2>/dev/null)" -export GPG_TTY=$TTY +export GPG_TTY="$(tty)" [ -n "$MBSYNCRC" ] && alias mbsync="mbsync -c $MBSYNCRC" || MBSYNCRC="$HOME/.mbsyncrc" From f8e59b9ab76639b77a94e8c6c293e0897d6aa874 Mon Sep 17 00:00:00 2001 From: Gil Oliveira Date: Fri, 17 Sep 2021 23:19:10 +0100 Subject: [PATCH 168/225] Added NOVA School of Science and Technology domains --- share/domains.csv | 2 ++ 1 file changed, 2 insertions(+) diff --git a/share/domains.csv b/share/domains.csv index 2ec18f1..aa35439 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -45,6 +45,7 @@ brew-meister.com,imap.mail.com,993,smtp.mail.com,587 bruttocarattere.org,mail.autistici.org,993,smtp.autistici.org,465 btinternet.com,mail.btinternet.com,993,mail.btinternet.com,587 calstatela.edu,outlook.office365.com,993,smtp.office365.com,587 +campus.fct.unl.pt,imap.gmail.com,993,smtp.gmail.com,587 canaglie.net,mail.autistici.org,993,smtp.autistici.org,465 canaglie.org,mail.autistici.org,993,smtp.autistici.org,465 carleton.ca,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 @@ -100,6 +101,7 @@ europe.com,imap.mail.com,993,smtp.mail.com,587 ex-studenti.unitn.it,imap.gmail.com,993,smtp.gmail.com,587 fastmail.com,imap.fastmail.com,993,smtp.fastmail.com,465 fastmail.fm,imap.fastmail.com,993,smtp.fastmail.com,465 +fct.unl.pt,imap.gmail.com,993,smtp.gmail.com,587 firemail.cc,mail.cock.li,993,mail.cock.li,587 forpsi.com,imap.forpsi.com,993,smtp.forpsi.com,465 forthnet.gr,mail.forthnet.gr,993,smtp-auth.forthnet.gr,465 From 8d177222d6d07ada68930a64a0f7a2e320817094 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 23 Sep 2021 12:59:15 -0400 Subject: [PATCH 169/225] don't show message info anymore --- bin/mailsync | 13 +------------ share/domains.csv | 1 + 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/bin/mailsync b/bin/mailsync index 4469d55..bed86a9 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -33,7 +33,6 @@ export GPG_TTY="$(tty)" case "$(uname)" in Darwin) notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $account\"" && sleep 2 ;} - messageinfo() { osascript -e "display notification with title \"📧 $from\" subtitle \"$subject\"" ;} ;; *) case "$(readlink -f /sbin/init)" in @@ -46,10 +45,6 @@ case "$(uname)" in export DISPLAY=$x notify-send --app-name="mutt-wizard" "mutt-wizard" "📬 $2 new mail(s) in \`$1\` account." done ;} - messageinfo() { [ -n "$pgrepoutput" ] && for x in ${displays:-0:}; do - export DISPLAY=$x - notify-send --app-name="mutt-wizard" "📧$from:" "$subject" - done ;} ;; esac @@ -67,13 +62,7 @@ syncandnotify() { -type f -newer "${XDG_CONFIG_HOME:-$HOME/.config}/mutt/.mailsynclastrun" 2> /dev/null) newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l) case 1 in - $((newcount > 5)) ) notify "$acc" "$newcount" ;; - $((newcount > 0)) ) for file in $new; do - # Extract subject and sender from mail. - from=$(awk '/^From: / && ++n ==1,/^\<.*\>:/' "$file" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | awk '{ $1=""; if (NF>=3)$NF=""; print $0 }' | sed 's/^[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//') - subject=$(awk '/^Subject: / && ++n == 1,/^\<.*\>: / && ++i == 2' "$file" | head -n 1 | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | sed 's/^Subject: //' | sed 's/^{[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//' | tr -d '\n') - messageinfo & - done ;; + $((newcount > 0)) ) notify "$acc" "$newcount" ;; esac } diff --git a/share/domains.csv b/share/domains.csv index 2ec18f1..a3eb574 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -49,6 +49,7 @@ canaglie.net,mail.autistici.org,993,smtp.autistici.org,465 canaglie.org,mail.autistici.org,993,smtp.autistici.org,465 carleton.ca,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 cash4u.com,imap.mail.com,993,smtp.mail.com,587 +cedars.xyz,imap.cedars.xyz,993,smtp.cedars.xyz,465 ceng.metu.edu.tr,imap.ceng.metu.edu.tr,993,mailhost.ceng.metu.edu.tr,587 cheerful.com,imap.mail.com,993,smtp.mail.com,587 chef.net,imap.mail.com,993,smtp.mail.com,587 From e8458ace20a1e553df1c6249b9ef27234dd2aafd Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 23 Sep 2021 13:06:17 -0400 Subject: [PATCH 170/225] fix #691, fix #689, fix #690 --- Makefile | 4 ++-- bin/mw | 10 +--------- share/domains.csv | 2 +- share/unbind.muttrc | 37 +++++++++++++++++++++++++++++++++++++ 4 files changed, 41 insertions(+), 12 deletions(-) create mode 100644 share/unbind.muttrc diff --git a/Makefile b/Makefile index 5cd5bf2..64036d0 100644 --- a/Makefile +++ b/Makefile @@ -14,8 +14,8 @@ install: chmod 755 $(DESTDIR)$(PREFIX)/bin/mw $(DESTDIR)$(PREFIX)/bin/mailsync $(DESTDIR)$(PREFIX)/bin/openfile mkdir -p $(DESTDIR)$(PREFIX)/share/mutt-wizard chmod 755 $(DESTDIR)$(PREFIX)/share/mutt-wizard - cp -f share/mailcap share/domains.csv share/mutt-wizard.muttrc $(DESTDIR)$(PREFIX)/share/mutt-wizard - chmod 644 $(DESTDIR)$(PREFIX)/share/mutt-wizard/mailcap $(DESTDIR)$(PREFIX)/share/mutt-wizard/domains.csv $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrc + cp -f share/mailcap share/domains.csv share/mutt-wizard.muttrc share/unbind.muttrc $(DESTDIR)$(PREFIX)/share/mutt-wizard + chmod 644 $(DESTDIR)$(PREFIX)/share/mutt-wizard/mailcap $(DESTDIR)$(PREFIX)/share/mutt-wizard/domains.csv $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrc $(DESTDIR)$(PREFIX)/share/mutt-wizard/unbind.muttrc mkdir -p $(DESTDIR)$(MANPREFIX)/man1 cp -f mw.1 $(DESTDIR)$(MANPREFIX)/man1/mw.1 chmod 644 $(DESTDIR)$(MANPREFIX)/man1/mw.1 diff --git a/bin/mw b/bin/mw index e63fff2..2b9a41a 100755 --- a/bin/mw +++ b/bin/mw @@ -101,16 +101,8 @@ set header_cache = $cachedir/$fulladdr/headers set message_cachedir = $cachedir/$fulladdr/bodies set mbox_type = Maildir set hostname = \"$hostname\" +source $muttshare/unbind.muttrc $extra - -bind index,pager gg noop -bind index,pager g noop -bind index,pager M noop -bind index,pager C noop -bind index gg first-entry -unmailboxes * -unalternates * -unset signature $synccmd " > "$accdir/$idnum-$fulladdr.muttrc" diff --git a/share/domains.csv b/share/domains.csv index 672a1c6..e307b22 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -50,7 +50,7 @@ canaglie.net,mail.autistici.org,993,smtp.autistici.org,465 canaglie.org,mail.autistici.org,993,smtp.autistici.org,465 carleton.ca,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 cash4u.com,imap.mail.com,993,smtp.mail.com,587 -cedars.xyz,imap.cedars.xyz,993,smtp.cedars.xyz,465 +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 cheerful.com,imap.mail.com,993,smtp.mail.com,587 chef.net,imap.mail.com,993,smtp.mail.com,587 diff --git a/share/unbind.muttrc b/share/unbind.muttrc new file mode 100644 index 0000000..330d823 --- /dev/null +++ b/share/unbind.muttrc @@ -0,0 +1,37 @@ +# vim: filetype=neomuttrc + +# This is an embarrassing and hacky file that unbinds a bunch of binds between +# switching accounts. It is called each time an account is changed. + +bind index,pager gi noop +bind index,pager gs noop +bind index,pager gd noop +bind index,pager ga noop +bind index,pager gS noop +bind index,pager gj noop +bind index,pager gt noop +bind index,pager Mi noop +bind index,pager Ms noop +bind index,pager Md noop +bind index,pager Ma noop +bind index,pager MS noop +bind index,pager Mj noop +bind index,pager Mt noop +bind index,pager Ci noop +bind index,pager Cs noop +bind index,pager Cd noop +bind index,pager Ca noop +bind index,pager CS noop +bind index,pager Cj noop +bind index,pager Ct noop +bind index,pager gg noop +bind index,pager g noop +bind index,pager M noop +bind index,pager C noop +unset hostname +unmy_hdr Organization +unmailboxes * +unalternates * +unset signature + +bind index gg first-entry From c88994e730a290e466565013e044bd0921fe6fbf Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 23 Sep 2021 13:31:07 -0400 Subject: [PATCH 171/225] decrease gnuisms --- bin/mailsync | 2 +- bin/mw | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/mailsync b/bin/mailsync index bed86a9..9490458 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -14,7 +14,7 @@ # Run only if user logged in (prevent cron errors) pgrep -u "${USER:=$LOGNAME}" >/dev/null || { echo "$USER not logged in; sync will not run."; exit ;} # Run only if not already running in other instance -pidof mbsync >/dev/null && { echo "mbsync is already running."; exit ;} +pgrep mbsync >/dev/null && { echo "mbsync is already running."; exit ;} # First, we have to get the right variables for the mbsync file, the pass # archive, notmuch and the GPG home. This is done by searching common profile diff --git a/bin/mw b/bin/mw index 2b9a41a..204f6ee 100755 --- a/bin/mw +++ b/bin/mw @@ -129,7 +129,7 @@ set ssl_force_tls = yes" pop) synccmd="macro index o \"mpop $fulladdr\" \"run mpop to get $fulladdr's mail\"" folder="$maildir/$fulladdr" prepmpop ;; - *) synccmd="macro index o \"mbsync $fulladdr\" \"run mbsync to sync $fulladdr\"" + *) synccmd="macro index o \"mw -y $fulladdr\" \"run mbsync to sync $fulladdr\"" folder="$maildir/$fulladdr" prepmbsync ;; esac @@ -227,7 +227,7 @@ getboxes() { if [ -n "${force+x}" ] ; then mailboxes="$(echo "$info" | grep -v HasChildren | sed "s/.*\" //;s/\"//g" | tr -d ' ')" fi [ "$type" = "pop" ] && mailboxes="INBOX" - getaccounts; for x in $(seq 1 9); do echo "$accounts" | grep -q "^$x:" || { export idnum="$x"; break ;}; done + getaccounts; for x in 1 2 3 4 5 6 7 8 9; do echo "$accounts" | grep -q "^$x:" || { export idnum="$x"; break ;}; done toappend="mailboxes $(echo "$mailboxes" | sed "s/^/\"=/;s/$/\"/" | paste -sd ' ' - )" IFS=' ' From fcf4ba52c357ed05a2b6494c25ef3bab4d4e1c0e Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 23 Sep 2021 15:47:59 -0400 Subject: [PATCH 172/225] id numbers removed from filenames --- bin/mw | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/bin/mw b/bin/mw index c0044e8..945b5de 100755 --- a/bin/mw +++ b/bin/mw @@ -34,7 +34,7 @@ checkbasics() { command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2" 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 "[0-9]-.*.muttrc" | sed "s/-/: /;s/\.muttrc$//" | sort -n)" ;} +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 ;} @@ -104,12 +104,12 @@ set hostname = \"$hostname\" source $muttshare/unbind.muttrc $extra $synccmd -" > "$accdir/$idnum-$fulladdr.muttrc" +" > "$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/$idnum-$fulladdr.muttrc" >> "$muttrc" - echo "macro index,pager i$idnum 'source $accdir/$idnum-$fulladdr.muttrc!;' \"switch to $fulladdr\"" >> "$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() { \ @@ -156,18 +156,18 @@ delete() { if [ -z "${fulladdr+x}" ]; then echo "Select the account you would like to delete (by number):" list || exit 1 read -r input - match="^$input:" + match="^\s*$input\s\+" else - match=" $fulladdr$" + match="\s\+$fulladdr$" getaccounts fi - fulladdr="$(echo "$accounts" | grep "$match" | cut -f2 -d' ')" + fulladdr="$(echo "$accounts" | grep "$match" | grep -o "\S*@\S*")" [ -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/"[1-9]"-$fulladdr.muttrc" + 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 @@ -224,11 +224,15 @@ getboxes() { if [ -n "${force+x}" ] ; then else info="$(curl --location-trusted -s -m 5 --user "$login:$(pass "$fulladdr")" --url "${protocol:-imaps}://$imap:${iport:-993}")" [ -z "$info" ] && echo "Log-on not successful." && return 1 - mailboxes="$(echo "$info" | grep -v HasChildren | sed "s/.*\" //;s/\"//g" | tr -d ' -')" + mailboxes="$(echo "$info" | grep -v HasChildren | sed "s/.*\" //;s/\"//g" | tr -d '\r')" fi [ "$type" = "pop" ] && mailboxes="INBOX" - getaccounts; for x in 1 2 3 4 5 6 7 8 9; do echo "$accounts" | grep -q "^$x:" || { export idnum="$x"; break ;}; done + getaccounts + usednums="$(grep -o "^macro.* i[0-9]\+ " "$muttrc" | grep -o "[0-9]" | sort -u)" + for x in 1 2 3 4 5 6 7 8 9; do + echo "$usednums" | grep -q "$x" || + { export idnum="$x"; break ;} + done toappend="mailboxes \`mdir=$maildir/$fulladdr/; find \$mdir -mindepth 1 -type d -name cur | sed -e 's:/cur\$:\":' -e \"s:\$mdir:\\\"=:\" | sort | tr '\\\n' ' '\`" IFS=' ' @@ -246,7 +250,7 @@ getboxes() { if [ -n "${force+x}" ] ; then unset IFS } -finalize() { echo "$toappend" >> "$accdir/$idnum-$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" echo "$fulladdr (account #$idnum) added successfully." command -V urlview >/dev/null 2>&1 && [ ! -f "$HOME/.urlview" ] && echo "COMMAND \$BROWSER" > "$HOME/.urlview" From 8c668a22e09d4118a49bbd75bc3539c297289029 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 23 Sep 2021 16:04:28 -0400 Subject: [PATCH 173/225] lol --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mw b/bin/mw index 945b5de..6c7438e 100755 --- a/bin/mw +++ b/bin/mw @@ -168,7 +168,7 @@ delete() { if [ -z "${fulladdr+x}" ]; then 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 "/[0-9]-$fulladdr.muttrc/d" "/$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 "$fulladdr" >/dev/null 2>&1 From 7a792c7c11d315132a062c800b0a35cbccd9195d Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 23 Sep 2021 16:10:31 -0400 Subject: [PATCH 174/225] actual lol --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mw b/bin/mw index 6c7438e..051bf54 100755 --- a/bin/mw +++ b/bin/mw @@ -168,7 +168,7 @@ delete() { if [ -z "${fulladdr+x}" ]; then 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" "/$fulladdr.muttrc/d" "$muttrc" 2>/dev/null; rm -f "$muttrc"bu + 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 "$fulladdr" >/dev/null 2>&1 From a3fc13e5ce54cd8d0e139e338ac75370e26c9184 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 23 Sep 2021 16:12:07 -0400 Subject: [PATCH 175/225] 465 now default instead of 587 --- README.md | 2 +- bin/mw | 6 +++--- mw.1 | 2 +- share/domains.csv | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 2aee255..a19170b 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ The mutt-wizard runs via the command `mw`. Once setup is complete, you'll use - `-i` -- IMAP server address - `-I` -- IMAP server port (otherwise assumed to be 993) - `-s` -- SMTP server address -- `-S` -- SMTP server port (otherwise assumed to be 587) +- `-S` -- SMTP server port (otherwise assumed to be 465) - `-m` -- Maximum number of emails to be kept offline. No maximum is default functionality. - `-x` -- Account password. You will be prompted for it otherwise. diff --git a/bin/mw b/bin/mw index 051bf54..8adb0b9 100755 --- a/bin/mw +++ b/bin/mw @@ -40,7 +40,7 @@ list() { getaccounts && [ -n "$accounts" ] && echo "$accounts" || exit 1 ;} prepmsmtp() { echo "account $fulladdr host $smtp -port ${sport:-587} +port ${sport:-465} from $fulladdr user $login passwordeval \"pass $fulladdr\" @@ -48,7 +48,7 @@ auth ${auth:-on} tls on tls_trust_file $sslcert logfile $msmtplog -$tlsline +${tlsline:-tls_starttls off} " >> "$msmtprc" } @@ -193,7 +193,7 @@ askinfo() { \ read -r imap [ -z "$smtp" ] && echo "Give your email server's SMTP address (excluding the port number):" && read -r smtp - [ "$sport" = 465 ] && tlsline="tls_starttls off" + [ "$sport" = 587 ] && tlsline="# tls_starttls" [ -z "$realname" ] && realname="${fulladdr%%@*}" hostname="$(echo "$fulladdr" | cut -d @ -f 2)" login="${login:-$fulladdr}" diff --git a/mw.1 b/mw.1 index 26d9569..a8c5c8e 100644 --- a/mw.1 +++ b/mw.1 @@ -63,7 +63,7 @@ IMAP/POP server port (assumed to be 993 for IMAP and 995 for POP if not specifie SMTP server address .TP .B -S -SMTP server port (assumed to be 587 if not specified) +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. diff --git a/share/domains.csv b/share/domains.csv index e307b22..854d383 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -160,7 +160,7 @@ live.rhul.ac.uk,outlook.office365.com,993,smtp.office365.com,587 logorroici.org,mail.autistici.org,993,smtp.autistici.org,465 loves.dicksinhisan.us,mail.cock.li,993,mail.cock.li,587 loves.dicksinmyan.us,mail.cock.li,993,mail.cock.li,587 -lukesmith.xyz,mail.lukesmith.xyz,993,mail.lukesmith.xyz,587 +lukesmith.xyz,mail.lukesmith.xyz,993,mail.lukesmith.xyz,465 luther.edu,imap.gmail.com,993,smtp.gmail.com,587 mac.com,imap.mail.me.com,993,smtp.mail.me.com,587 mace.ac.in,imap.gmail.com,993,smtp.gmail.com,587 From b6f0bd44267ea5a5f46ab27d4786ca72ae3511cd Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 23 Sep 2021 19:56:58 -0400 Subject: [PATCH 176/225] more computationally efficient idnum discovery --- bin/mw | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/bin/mw b/bin/mw index 8adb0b9..01bf86b 100755 --- a/bin/mw +++ b/bin/mw @@ -227,11 +227,9 @@ getboxes() { if [ -n "${force+x}" ] ; then mailboxes="$(echo "$info" | grep -v HasChildren | sed "s/.*\" //;s/\"//g" | tr -d '\r')" fi [ "$type" = "pop" ] && mailboxes="INBOX" - getaccounts - usednums="$(grep -o "^macro.* i[0-9]\+ " "$muttrc" | grep -o "[0-9]" | sort -u)" - for x in 1 2 3 4 5 6 7 8 9; do - echo "$usednums" | grep -q "$x" || - { export idnum="$x"; break ;} + for x in $(sed -n "/^macro.* i[0-9] / s/\(^macro.* i\| .*\)//gp " $muttrc | sort -u; echo 0); do + idnum=$((idnum + 1)) + [ $idnum -eq $x ] || break done toappend="mailboxes \`mdir=$maildir/$fulladdr/; find \$mdir -mindepth 1 -type d -name cur | sed -e 's:/cur\$:\":' -e \"s:\$mdir:\\\"=:\" | sort | tr '\\\n' ' '\`" IFS=' From bd0075898ae441bb5e59f83d8b34df68b55aafb3 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 23 Sep 2021 22:18:54 -0400 Subject: [PATCH 177/225] hardcode mailbox names. don't remake shortcuts. --- Makefile | 4 ++-- bin/mailsync | 2 +- bin/mw | 34 +++++++--------------------------- share/mutt-wizard.muttrc | 23 +++++++++++++++++++++++ share/switch.muttrc | 10 ++++++++++ share/unbind.muttrc | 37 ------------------------------------- 6 files changed, 43 insertions(+), 67 deletions(-) create mode 100644 share/switch.muttrc delete mode 100644 share/unbind.muttrc diff --git a/Makefile b/Makefile index 64036d0..03e2df1 100644 --- a/Makefile +++ b/Makefile @@ -14,8 +14,8 @@ install: chmod 755 $(DESTDIR)$(PREFIX)/bin/mw $(DESTDIR)$(PREFIX)/bin/mailsync $(DESTDIR)$(PREFIX)/bin/openfile mkdir -p $(DESTDIR)$(PREFIX)/share/mutt-wizard chmod 755 $(DESTDIR)$(PREFIX)/share/mutt-wizard - cp -f share/mailcap share/domains.csv share/mutt-wizard.muttrc share/unbind.muttrc $(DESTDIR)$(PREFIX)/share/mutt-wizard - chmod 644 $(DESTDIR)$(PREFIX)/share/mutt-wizard/mailcap $(DESTDIR)$(PREFIX)/share/mutt-wizard/domains.csv $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrc $(DESTDIR)$(PREFIX)/share/mutt-wizard/unbind.muttrc + cp -f share/mailcap share/domains.csv share/mutt-wizard.muttrc share/switch.muttrc $(DESTDIR)$(PREFIX)/share/mutt-wizard + chmod 644 $(DESTDIR)$(PREFIX)/share/mutt-wizard/mailcap $(DESTDIR)$(PREFIX)/share/mutt-wizard/domains.csv $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrc $(DESTDIR)$(PREFIX)/share/mutt-wizard/switch.muttrc mkdir -p $(DESTDIR)$(MANPREFIX)/man1 cp -f mw.1 $(DESTDIR)$(MANPREFIX)/man1/mw.1 chmod 644 $(DESTDIR)$(MANPREFIX)/man1/mw.1 diff --git a/bin/mailsync b/bin/mailsync index 9490458..36f963b 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -36,7 +36,7 @@ case "$(uname)" in ;; *) case "$(readlink -f /sbin/init)" in - *systemd*) export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus ;; + *systemd*|*openrc*) export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus ;; esac # remember if a display server is running since `ps` doesn't always contain a display pgrepoutput="$(pgrep -a X\(org\|wayland\))" diff --git a/bin/mw b/bin/mw index 01bf86b..16df7d3 100755 --- a/bin/mw +++ b/bin/mw @@ -101,7 +101,11 @@ set header_cache = $cachedir/$fulladdr/headers set message_cachedir = $cachedir/$fulladdr/bodies set mbox_type = Maildir set hostname = \"$hostname\" -source $muttshare/unbind.muttrc +source $muttshare/switch.muttrc +set spoolfile = "+INBOX" +set postponed = "+Drafts" +set trash = "+Trash" +set record = "+Sent" $extra $synccmd " > "$accdir/$fulladdr.muttrc" @@ -135,7 +139,6 @@ set ssl_force_tls = yes" esac prepmsmtp prepmutt - prepnotmuch # Create a notmuch config file if not present already. } @@ -211,14 +214,6 @@ createpass() { echo "$password" > "$PASSWORD_STORE_DIR/$fulladdr" getpass() { while : ; do pass rm -f "$fulladdr" >/dev/null 2>&1 pass insert -f "$fulladdr" && break; done ;} -formatShortcut() { toappend="$toappend -macro index,pager g$1 \"=$3\" \"go to $2\" -macro index,pager M$1 \";=$3\" \"move mail to $2\" -macro index,pager C$1 \";=$3\" \"copy mail to $2\"" ;} - -setBox() { toappend="$toappend -set $1 = \"+$2\"" ;} - getboxes() { if [ -n "${force+x}" ] ; then mailboxes="$(printf "INBOX\\nDrafts\\nJunk\\nTrash\\nSent\\nArchive")" else @@ -232,20 +227,6 @@ getboxes() { if [ -n "${force+x}" ] ; then [ $idnum -eq $x ] || break done toappend="mailboxes \`mdir=$maildir/$fulladdr/; find \$mdir -mindepth 1 -type d -name cur | sed -e 's:/cur\$:\":' -e \"s:\$mdir:\\\"=:\" | sort | tr '\\\n' ' '\`" - IFS=' -' - for x in $mailboxes; do - case "$x" in - *[Ss][Ee][Nn][Tt]*) setBox record "$x"; formatShortcut s sent "$x" ;; - *[Dd][Rr][Aa][Ff][Tt][Ss]*) setBox postponed "$x"; formatShortcut d drafts "$x" ;; - *[Tt][Rr][Aa][Ss][Hh]*) formatShortcut t trash "$x"; setBox trash "$x" ;; - *[Jj][Uu][Nn][Kk]*) formatShortcut j junk "$x" ;; - *[Aa][Rr][Cc][Hh][Ii][Vv][Ee]*) formatShortcut a archive "$x" ;; - *[Ss][Pp][Aa][Mm]*) formatShortcut S spam "$x" ;; - *[Ii][Nn][Bb][Oo][Xx]) formatShortcut i inbox "$x"; setBox spoolfile "$x" inbox="$x" ;; - esac - done - unset IFS } finalize() { echo "$toappend" >> "$accdir/$fulladdr.muttrc" @@ -257,7 +238,7 @@ finalize() { echo "$toappend" >> "$accdir/$fulladdr.muttrc" prepnotmuch() { \ [ -z "$NOTMUCH_CONFIG" ] && NOTMUCH_CONFIG="$HOME/.notmuch-config" [ -f "$NOTMUCH_CONFIG" ] && return 0 - nmbasic="[database] + echo "[database] path=$maildir [user] name=$realname @@ -270,8 +251,7 @@ exclude_tags=deleted;spam; [maildir] synchronize_flags=true [crypto] -gpg_path=$GPG" - echo "$nmbasic" > "$NOTMUCH_CONFIG" ;} +gpg_path=$GPG" > "$NOTMUCH_CONFIG" ;} togglecron() { cron="$(mktemp)" crontab -l > "$cron" diff --git a/share/mutt-wizard.muttrc b/share/mutt-wizard.muttrc index 2cb7c8e..a12a77e 100644 --- a/share/mutt-wizard.muttrc +++ b/share/mutt-wizard.muttrc @@ -27,11 +27,15 @@ auto_view text/html # automatically show html (mailcap uses lynx) auto_view application/pgp-encrypted #set display_filter = "tac | sed '/\\\[-- Autoview/,+1d' | tac" # Suppress autoview messages. alternative_order text/plain text/enriched text/html + bind index,pager i noop bind index,pager g noop bind index \Cf noop +bind index,pager M noop +bind index,pager C noop # General rebindings +bind index gg first-entry bind index j next-entry bind index k previous-entry bind attach view-mailcap @@ -65,6 +69,25 @@ bind pager \031 previous-line # Mouse wheel bind pager \005 next-line # Mouse wheel bind editor complete-query +macro index,pager gi "=INBOX" "go to inbox" +macro index,pager Mi ";=INBOX" "move mail to inbox" +macro index,pager Ci ";=INBOX" "copy mail to inbox" +macro index,pager gd "=Drafts" "go to drafts" +macro index,pager Md ";=Drafts" "move mail to drafts" +macro index,pager Cd ";=Drafts" "copy mail to drafts" +macro index,pager gj "=Junk" "go to junk" +macro index,pager Mj ";=Junk" "move mail to junk" +macro index,pager Cj ";=Junk" "copy mail to junk" +macro index,pager gt "=Trash" "go to trash" +macro index,pager Mt ";=Trash" "move mail to trash" +macro index,pager Ct ";=Trash" "copy mail to trash" +macro index,pager gs "=Sent" "go to sent" +macro index,pager Ms ";=Sent" "move mail to sent" +macro index,pager Cs ";=Sent" "copy mail to sent" +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_opportunistic_encrypt = yes #set pgp_self_encrypt = yes diff --git a/share/switch.muttrc b/share/switch.muttrc new file mode 100644 index 0000000..c808c99 --- /dev/null +++ b/share/switch.muttrc @@ -0,0 +1,10 @@ +# vim: filetype=neomuttrc + +# This is an embarrassing and hacky file that unbinds a bunch of binds between +# switching accounts. It is called each time an account is changed. + +unset hostname +unmy_hdr Organization +unmailboxes * +unalternates * +unset signature diff --git a/share/unbind.muttrc b/share/unbind.muttrc deleted file mode 100644 index 330d823..0000000 --- a/share/unbind.muttrc +++ /dev/null @@ -1,37 +0,0 @@ -# vim: filetype=neomuttrc - -# This is an embarrassing and hacky file that unbinds a bunch of binds between -# switching accounts. It is called each time an account is changed. - -bind index,pager gi noop -bind index,pager gs noop -bind index,pager gd noop -bind index,pager ga noop -bind index,pager gS noop -bind index,pager gj noop -bind index,pager gt noop -bind index,pager Mi noop -bind index,pager Ms noop -bind index,pager Md noop -bind index,pager Ma noop -bind index,pager MS noop -bind index,pager Mj noop -bind index,pager Mt noop -bind index,pager Ci noop -bind index,pager Cs noop -bind index,pager Cd noop -bind index,pager Ca noop -bind index,pager CS noop -bind index,pager Cj noop -bind index,pager Ct noop -bind index,pager gg noop -bind index,pager g noop -bind index,pager M noop -bind index,pager C noop -unset hostname -unmy_hdr Organization -unmailboxes * -unalternates * -unset signature - -bind index gg first-entry From 418565eb94b8d95bb790357afbcf2784511573b5 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Tue, 5 Oct 2021 12:17:25 -0400 Subject: [PATCH 178/225] minor tweaks --- bin/mailsync | 2 +- bin/mw | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/mailsync b/bin/mailsync index 36f963b..ca7411d 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -43,7 +43,7 @@ case "$(uname)" in displays="$(echo "$pgrepoutput" | grep -wo "[0-9]*:[0-9]\+" | sort -u)" notify() { [ -n "$pgrepoutput" ] && for x in ${displays:-0:}; do export DISPLAY=$x - notify-send --app-name="mutt-wizard" "mutt-wizard" "📬 $2 new mail(s) in \`$1\` account." + notify-send --app-name="mutt-wizard" "New mail!" "📬 $2 new mail(s) in \`$1\` account." done ;} ;; esac diff --git a/bin/mw b/bin/mw index 16df7d3..d39b0a6 100755 --- a/bin/mw +++ b/bin/mw @@ -198,7 +198,7 @@ askinfo() { \ read -r smtp [ "$sport" = 587 ] && tlsline="# tls_starttls" [ -z "$realname" ] && realname="${fulladdr%%@*}" - hostname="$(echo "$fulladdr" | cut -d @ -f 2)" + hostname="${fulladdr#*@}" login="${login:-$fulladdr}" if [ -n "${password+x}" ]; then createpass @@ -222,9 +222,9 @@ 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 | sort -u; echo 0); do + for x in $(sed -n "/^macro.* i[0-9] / s/\(^macro.* i\| .*\)//gp " "$muttrc" | sort -u; echo 0); do idnum=$((idnum + 1)) - [ $idnum -eq $x ] || break + [ "$idnum" -eq "$x" ] || break done toappend="mailboxes \`mdir=$maildir/$fulladdr/; find \$mdir -mindepth 1 -type d -name cur | sed -e 's:/cur\$:\":' -e \"s:\$mdir:\\\"=:\" | sort | tr '\\\n' ' '\`" } @@ -335,7 +335,7 @@ while getopts "fpPXlhodTYD:y:i:I:s:S:u:a:n:x:m:t:" o; do case "${o}" in smtp="127.0.0.1" sport="1025" auth="login" - tlsline="tls_fingerprint $(msmtp --serverinfo --host=$smtp --port=$sport --tls --tls-certcheck=off | awk '/SHA256:/ {print $2}')" + tlsline="tls_fingerprint $(msmtp --serverinfo --host=$smtp --port=$sport --tls --tls-certcheck=off | sed -n '/SHA256:/ s/^\s*SHA256:\s*// p')" setact add || exit 1 ;; *) mwinfo; exit 1 ;; From 85c5d01dcd09058094a8a180c38751e88416b1f4 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Wed, 6 Oct 2021 22:51:30 -0400 Subject: [PATCH 179/225] mw -r to reorder account numbers --- README.md | 1 + bin/mw | 24 +++++++++++++++++++++++- mw.1 | 3 +++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a19170b..372aa02 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,7 @@ The mutt-wizard runs via the command `mw`. Once setup is complete, you'll use - `mw -D your@email.com` -- delete account settings without confirmation - `mw -t 30` -- toggle automatic mailsync to every 30 minutes - `mw -T` -- toggle mailsync without specifying minutes (default is 10) +- `mw -r` -- reorder account shortcut numbers - `pass edit mw-your@email.com` -- revise an account's password ### Options usable when adding an account diff --git a/bin/mw b/bin/mw index d39b0a6..5205a13 100755 --- a/bin/mw +++ b/bin/mw @@ -285,6 +285,7 @@ Main actions: -Y Sync mail for all accounts -t number Toggle automatic mailsync every minutes -T Toggle automatic mailsync + -r Reorder account numbers Options allowed with -a: -u Account login name if not full address @@ -307,8 +308,28 @@ To change an account's password, run \`pass edit your@email.com\`. EOF } -while getopts "fpPXlhodTYD:y:i:I:s:S:u:a:n:x:m:t:" o; do case "${o}" in +reorder(){ + tempfile="$(mktemp -u)" + trap 'rm -f $tempfile' HUP INT QUIT TERM PWR EXIT + echo "# Carefully reorder these accounts with the desired numbers." > "$tempfile" + sed -n " + / i[0-9] / s?\(.* i\|' "$tempfile" + ${EDITOR:-vim} "$tempfile" || exit 1 + default="$(sort -n "$tempfile" | head -n 1)" + default="${default#* }" + sed -ibu "/.* i[0-9] .*.muttrc/d" "$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" + +} + +while getopts "rfpPXlhodTYD:y:i:I:s:S:u:a:n:x:m:t:" o; do case "${o}" in l) setact list || exit 1 ;; + r) setact reorder || exit 1 ;; d) setact delete || exit 1 ;; D) setact delete || exit 1 ; fulladdr="$OPTARG" ;; y) setact sync || exit 1 ; fulladdr="$OPTARG" ;; @@ -347,5 +368,6 @@ case "$action" in delete) delete ;; sync) mailsync $fulladdr ;; toggle) togglecron ;; + reorder) reorder ;; *) mwinfo; exit 1 ;; esac diff --git a/mw.1 b/mw.1 index a8c5c8e..4bdb383 100644 --- a/mw.1 +++ b/mw.1 @@ -41,6 +41,9 @@ toggle a cronjob that syncs your mail every 15 minutes (or any other number unde .TP .B -T toggle a cronjob without specifying minutes between sync +.TP +.B -r +reorder account shortcut numbers .SH OPTIONS FOR ADDING ACCOUNTS These can be specified on the command line, otherwise, you will be prompted for what is necessary. mutt-wizard knows the IMAP/SMTP server information for most email providers, so specifying them is usually redundant. .TP From 311a7cf810221455b8a0a32bad38ca753f894bab Mon Sep 17 00:00:00 2001 From: Sestowner Date: Mon, 18 Oct 2021 12:50:04 +0300 Subject: [PATCH 180/225] Add ukr.net --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index 854d383..d59cd32 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -287,6 +287,7 @@ ucdavis.edu,imap.gmail.com,993,smtp.gmail.com,587 uclive.ac.nz,outlook.office365.com,993,smtp.office365.com,587 ucsb.edu,imap.gmail.com,993,smtp.gmail.com,587 ucsc.edu,imap.gmail.com,993,smtp.gmail.com,587 +ukr.net,imap.ukr.net,993,smtp.ukr.net,465 uni-duesseldorf.de,mail.hhu.de,993,mail.hhu.de,465 uni-jena.de,imap.uni-jena.de,993,smtp.uni-jena.de,587 uni.strath.ac.uk,outlook.office365.com,993,smtp.office365.com,587 From eba3b0eb000cdfd1200ff154bc80bb02d06ae1dd Mon Sep 17 00:00:00 2001 From: "Gunnar K. Halvorsen" Date: Tue, 26 Oct 2021 13:37:32 +0200 Subject: [PATCH 181/225] Added domain to list --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index d59cd32..99517cc 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -111,6 +111,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 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 256c091196c6f7713f875e2a327f2c3755d5c45b Mon Sep 17 00:00:00 2001 From: Jberczel Date: Mon, 1 Nov 2021 11:52:59 -0400 Subject: [PATCH 182/225] Cleanup reorder account numbers action Refactors commit 85c5d01 * Keep the comment(s) when reordering account numbers in temp file. Users may accidently reorder rows or rename accounts rather than update order number. * Remove original default config from muttrc. Currently, script only removes the macro shortcuts .If you run reorder action multiple times, you'll end up sourcing multiple "default" config files. --- bin/mw | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/bin/mw b/bin/mw index 5205a13..bcca18d 100755 --- a/bin/mw +++ b/bin/mw @@ -308,23 +308,27 @@ To change an account's password, run \`pass edit your@email.com\`. EOF } -reorder(){ +reorder() { tempfile="$(mktemp -u)" trap 'rm -f $tempfile' HUP INT QUIT TERM PWR EXIT - echo "# Carefully reorder these accounts with the desired numbers." > "$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" default="$(sort -n "$tempfile" | head -n 1)" default="${default#* }" - sed -ibu "/.* i[0-9] .*.muttrc/d" "$muttrc" 2>/dev/null; rm -f "$muttrc"bu + sed -ibu " + /.* i[0-9] .*.muttrc/d + /^source.*accounts.*.muttrc/d + " "$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" - } while getopts "rfpPXlhodTYD:y:i:I:s:S:u:a:n:x:m:t:" o; do case "${o}" in From 29f264db233764a6963bce761b444091b603e114 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Mon, 1 Nov 2021 14:14:45 -0400 Subject: [PATCH 183/225] Revert "allow dynamically loading available mailboxes" This reverts commit 2cb2fa03452cb99537a1751961574a0b6d3253e0. --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mw b/bin/mw index 5205a13..d3129e7 100755 --- a/bin/mw +++ b/bin/mw @@ -226,7 +226,7 @@ getboxes() { if [ -n "${force+x}" ] ; then idnum=$((idnum + 1)) [ "$idnum" -eq "$x" ] || break done - toappend="mailboxes \`mdir=$maildir/$fulladdr/; find \$mdir -mindepth 1 -type d -name cur | sed -e 's:/cur\$:\":' -e \"s:\$mdir:\\\"=:\" | sort | tr '\\\n' ' '\`" + toappend="mailboxes $(echo "$mailboxes" | sed "s/^/\"=/;s/$/\"/" | paste -sd ' ' - )" } finalize() { echo "$toappend" >> "$accdir/$fulladdr.muttrc" From 2cb6dfb574834d3d17980d7c41473daa745d76cc Mon Sep 17 00:00:00 2001 From: cshjsc <47149574+cshjsc@users.noreply.github.com> Date: Tue, 2 Nov 2021 19:34:59 +0100 Subject: [PATCH 184/225] Fix html links splitting avoid line splitting. the width option is set to 80 by default, increasing it will avoid breaking long links in two different lines --- share/mailcap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/mailcap b/share/mailcap index b355f32..a49145f 100644 --- a/share/mailcap +++ b/share/mailcap @@ -1,6 +1,6 @@ text/plain; $EDITOR %s ; text/html; openfile %s ; nametemplate=%s.html -text/html; lynx -assume_charset=%{charset} -display_charset=utf-8 -dump %s; nametemplate=%s.html; copiousoutput; +text/html; lynx -assume_charset=%{charset} -display_charset=utf-8 -dump -width=1024 %s; nametemplate=%s.html; copiousoutput; image/*; openfile %s ; video/*; setsid mpv --quiet %s &; copiousoutput audio/*; mpv %s ; From bed0470f0db5c814f27a205f27d8fd4c1b42d79c Mon Sep 17 00:00:00 2001 From: "Gunnar K. Halvorsen" Date: Tue, 26 Oct 2021 13:37:32 +0200 Subject: [PATCH 185/225] Added domain to list --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index d59cd32..99517cc 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -111,6 +111,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 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 8e81135f8bb79930ed2495b90784cacc83cbb73f Mon Sep 17 00:00:00 2001 From: Matthew McCulley Date: Sun, 7 Nov 2021 09:05:27 -0500 Subject: [PATCH 186/225] Checks $HOME/.confg/zsh/.zshenv for Env variables --- bin/mailsync | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/mailsync b/bin/mailsync index ca7411d..e939b78 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -23,7 +23,8 @@ pgrep mbsync >/dev/null && { echo "mbsync is already running."; exit ;} eval "$(grep -h -- \ "^\s*\(export \)\?\(MBSYNCRC\|PASSWORD_STORE_DIR\|NOTMUCH_CONFIG\|GNUPGHOME\)=" \ "$HOME/.profile" "$HOME/.bash_profile" "$HOME/.zprofile" "$HOME/.config/zsh/.zprofile" "$HOME/.zshenv" \ - "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.config/zsh/.zshrc" "$HOME/.pam_environment" 2>/dev/null)" + "$HOME/.config/zsh/.zshenv" "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.config/zsh/.zshrc" \ + "$HOME/.pam_environment" 2>/dev/null)" export GPG_TTY="$(tty)" From 37c91057f78542e8970cf7698c0c1588153c30f2 Mon Sep 17 00:00:00 2001 From: Aisha Tammy Date: Fri, 31 Dec 2021 22:55:01 +0000 Subject: [PATCH 187/225] add GPG WKS publishing functionality Signed-off-by: Aisha Tammy --- bin/mw | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/mw b/bin/mw index d3129e7..fee8974 100755 --- a/bin/mw +++ b/bin/mw @@ -108,6 +108,8 @@ set trash = "+Trash" set record = "+Sent" $extra $synccmd +macro index \eg \"unset wait_keygpg --list-secret-keys; printf 'Enter email ID of user to publish: '; read eID; printf 'Enter fingerprint of GPG key to publish: '; read eFGPT; /usr/local/libexec/gpg-wks-client --create \\\$eFGPT \\\$eID | msmtp --read-envelope-from --read-recipients -a $fulladdr\" \"publish GPG key to WKS provider\" +macro index \eh \"/usr/local/libexec/gpg-wks-client --receive | msmtp --read-envelope-from --read-recipients -a $fulladdr\" \"confirm GPG publication\" " > "$accdir/$fulladdr.muttrc" [ ! -f "$muttrc" ] && echo "# vim: filetype=neomuttrc" > "$muttrc" From aba07e26f83da9055c16255ace3836f4bfba665e Mon Sep 17 00:00:00 2001 From: 187Qrly <56300140+187Qrly@users.noreply.github.com> Date: Sat, 1 Jan 2022 15:53:33 +0100 Subject: [PATCH 188/225] Make gentoo users aware that they need the "sasl" for the neomutt package. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 372aa02..ddf6f8b 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Specifically, this wizard: #### Dependencies -- `neomutt` - the email client. +- `neomutt` - the email client. (If you are using Gentoo GNU/Linux, you will need the `sasl` use flag to be enabled) - `curl` - tests connections (required at install). - `isync` - downloads and syncs the mail (required if storing IMAP mail locally). - `msmtp` - sends the email. From 0d98a9ef5b76fd60f58a8b8f3196f5d143668069 Mon Sep 17 00:00:00 2001 From: Thamognya <85227613+MeliodasZoom@users.noreply.github.com> Date: Mon, 3 Jan 2022 06:50:21 +0700 Subject: [PATCH 189/225] Update domains.csv --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index 99517cc..1cca410 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -274,6 +274,7 @@ tecnico.ulisboa.pt,mail.tecnico.ulisboa.pt,993,mail.tecnico.ulisboa.pt,465 teknik.io,mail.teknik.io,993,mail.teknik.io,587 telenet.be,imap.telenet.be,993,smtp.telenet.be,587 tfwno.gf,mail.cock.li,993,mail.cock.li,587 +thamognya.com,mail.thamognya.com,993,mail.thamognya.com,587 thunix.net,thunix.net,143,thunix.net,25 tlen.pl,poczta.o2.pl,993,poczta.o2.pl,465 tlu.edu,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 From b149d1c9ce80f489006c470636ead617b3082e42 Mon Sep 17 00:00:00 2001 From: Cameron Murtagh <43051455+CMurtagh-LGTM@users.noreply.github.com> Date: Tue, 4 Jan 2022 02:23:11 +0000 Subject: [PATCH 190/225] Add option to use user mailcap Added the option to have a `mailcap` file in `.config/mutt/`. This enables ease of changing what programs are used for viewing. --- 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 a12a77e..f99d74d 100644 --- a/share/mutt-wizard.muttrc +++ b/share/mutt-wizard.muttrc @@ -3,7 +3,7 @@ # mutt-wizard will have this file sourced from your muttrc. # In the interest of seamless updating, do not edit this file. # If you want to override any settings, set those in your muttrc. -set mailcap_path = /usr/local/share/mutt-wizard/mailcap:$mailcap_path +set mailcap_path = $HOME/.config/mutt/mailcap:/usr/local/share/mutt-wizard/mailcap:$mailcap_path set mime_type_query_command = "file --mime-type -b %s" set date_format="%y/%m/%d %I:%M%p" set index_format="%2C %Z %?X?A& ? %D %-15.15F %s (%-4.4c)" From a82a86c310bbe2c3a71ff4da3b9ed635fed4e06d Mon Sep 17 00:00:00 2001 From: Aisha Tammy Date: Mon, 10 Jan 2022 20:06:52 +0000 Subject: [PATCH 191/225] change path of command to use prefix Signed-off-by: Aisha Tammy --- bin/mw | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/mw b/bin/mw index fee8974..d2a67d7 100755 --- a/bin/mw +++ b/bin/mw @@ -108,8 +108,8 @@ set trash = "+Trash" set record = "+Sent" $extra $synccmd -macro index \eg \"unset wait_keygpg --list-secret-keys; printf 'Enter email ID of user to publish: '; read eID; printf 'Enter fingerprint of GPG key to publish: '; read eFGPT; /usr/local/libexec/gpg-wks-client --create \\\$eFGPT \\\$eID | msmtp --read-envelope-from --read-recipients -a $fulladdr\" \"publish GPG key to WKS provider\" -macro index \eh \"/usr/local/libexec/gpg-wks-client --receive | msmtp --read-envelope-from --read-recipients -a $fulladdr\" \"confirm GPG publication\" +macro index \eg \"unset wait_keygpg --list-secret-keys; printf 'Enter email ID of user to publish: '; read eID; printf 'Enter fingerprint of GPG key to publish: '; read eFGPT; $prefix/libexec/gpg-wks-client --create \\\$eFGPT \\\$eID | msmtp --read-envelope-from --read-recipients -a $fulladdr\" \"publish GPG key to WKS provider\" +macro index \eh \"$prefix/libexec/gpg-wks-client --receive | msmtp --read-envelope-from --read-recipients -a $fulladdr\" \"confirm GPG publication\" " > "$accdir/$fulladdr.muttrc" [ ! -f "$muttrc" ] && echo "# vim: filetype=neomuttrc" > "$muttrc" From e816f80a5a85a47f8128e89b0bb94c9fdf32d415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Huynh=20D=C6=B0=C6=A1ng?= Date: Sun, 30 Jan 2022 10:37:26 +0700 Subject: [PATCH 192/225] Update domains.csv --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index 1cca410..65625ef 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -328,3 +328,4 @@ zaclys.net,mail.zaclys.net,993,mail.zaclys.net,465 zju.edu.cn,imap.zju.edu.cn,993,smtp.zju.edu.cn,994 zoho.com,imap.zoho.com,993,smtp.zoho.com,465 zohomail.eu,imap.zoho.eu,993,smtp.zoho.eu,465 +sis.hust.edu.vn,outlook.office365.com,993,smtp.office365.com,587 From 6e869214b14d3ebffd5987b3ec50e6618ed289c0 Mon Sep 17 00:00:00 2001 From: Beau McCartney Date: Sun, 30 Jan 2022 22:02:00 -0700 Subject: [PATCH 193/225] Update domains.csv --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index 65625ef..f1fb031 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -285,6 +285,7 @@ tum.de,xmail.mwn.de,993,postout.lrz.de,587 txstate.edu,outlook.office365.com,993,smtp.office365.com,587 ua.pt,outlook.office365.com,993,mail.ua.pt,25 uach.mx,imap.gmail.com,993,smtp.gmail.com,587 +ucalgary.ca,outlook.office365.com,993,smtp.office365.com,587 ucdavis.edu,imap.gmail.com,993,smtp.gmail.com,587 uclive.ac.nz,outlook.office365.com,993,smtp.office365.com,587 ucsb.edu,imap.gmail.com,993,smtp.gmail.com,587 From 67b704808d64850461ecb11d9f6086086dbc1db6 Mon Sep 17 00:00:00 2001 From: Slin Lee Date: Wed, 9 Mar 2022 22:33:24 -0800 Subject: [PATCH 194/225] Wrap text when reading emails at 80 chars For increased legibility. --- share/mutt-wizard.muttrc | 1 + 1 file changed, 1 insertion(+) diff --git a/share/mutt-wizard.muttrc b/share/mutt-wizard.muttrc index f99d74d..3537aa8 100644 --- a/share/mutt-wizard.muttrc +++ b/share/mutt-wizard.muttrc @@ -27,6 +27,7 @@ auto_view text/html # automatically show html (mailcap uses lynx) auto_view application/pgp-encrypted #set display_filter = "tac | sed '/\\\[-- Autoview/,+1d' | tac" # Suppress autoview messages. alternative_order text/plain text/enriched text/html +set width = 80 # wordwrap when reading emails bind index,pager i noop bind index,pager g noop From 641587fbf751eec16818a5b858a8944aad305da5 Mon Sep 17 00:00:00 2001 From: Erick Chacon Date: Fri, 11 Mar 2022 23:49:23 -0500 Subject: [PATCH 195/225] Lancaster University (UK) and National University of Engineering (PERU) --- share/domains.csv | 2 ++ 1 file changed, 2 insertions(+) diff --git a/share/domains.csv b/share/domains.csv index f1fb031..e0aa74c 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -150,6 +150,7 @@ kean.edu,imap.gmail.com,993,smtp.gmail.com,587 kipras.org,mail.kipras.org,993,mail.kipras.org,587 krutt.org,mail.autistici.org,993,smtp.autistici.org,465 kth.se,webmail.kth.se,993,smtp.kth.se,587 +lancaster.ac.uk,outlook.office365.com,993,smtp.office365.com,587 larbs.xyz,mail.larbs.xyz,993,mail.larbs.xyz,587 lavabit.com,lavabit.com,993,lavabit.com,587 librem.one,imap.librem.one,993,smtp.librem.one,465 @@ -293,6 +294,7 @@ ucsc.edu,imap.gmail.com,993,smtp.gmail.com,587 ukr.net,imap.ukr.net,993,smtp.ukr.net,465 uni-duesseldorf.de,mail.hhu.de,993,mail.hhu.de,465 uni-jena.de,imap.uni-jena.de,993,smtp.uni-jena.de,587 +uni.edu.pe,imap.gmail.com,993,smtp.gmail.com,587 uni.strath.ac.uk,outlook.office365.com,993,smtp.office365.com,587 unilodz.eu,outlook.office365.com,993,smtp.office365.com,587 unitn.it,imap.gmail.com,993,smtp.gmail.com,587 From 65af1f047e672e2c5d42d457d891043bb407476d Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Tue, 29 Mar 2022 09:23:15 -0400 Subject: [PATCH 196/225] less secure fix --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 372aa02..b46408c 100644 --- a/README.md +++ b/README.md @@ -199,7 +199,7 @@ See Luke's website [here](https://lukesmith.xyz). Email him at - Gmail accounts need to create an [App Password](https://support.google.com/accounts/answer/185833?hl=en) to - use with _**less secure**_ applications. This password is single-use (i.e. + use with "less secure" applications. This password is single-use (i.e. for setup) and will be stored and encrypted locally. Enabling third-party applications requires turning off two-factor authentication and this will circumvent that. You might also need to manually "Enable IMAP" in the From e0f34910f34c2464d2fd57125d2a0542b4b75e63 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Tue, 29 Mar 2022 09:24:28 -0400 Subject: [PATCH 197/225] Revert "Wrap text when reading emails at 80 chars" This reverts commit 67b704808d64850461ecb11d9f6086086dbc1db6. --- share/mutt-wizard.muttrc | 1 - 1 file changed, 1 deletion(-) diff --git a/share/mutt-wizard.muttrc b/share/mutt-wizard.muttrc index 3537aa8..f99d74d 100644 --- a/share/mutt-wizard.muttrc +++ b/share/mutt-wizard.muttrc @@ -27,7 +27,6 @@ auto_view text/html # automatically show html (mailcap uses lynx) auto_view application/pgp-encrypted #set display_filter = "tac | sed '/\\\[-- Autoview/,+1d' | tac" # Suppress autoview messages. alternative_order text/plain text/enriched text/html -set width = 80 # wordwrap when reading emails bind index,pager i noop bind index,pager g noop From e9f58514536a042df853df9b5359dfd0ecf02aa0 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sat, 9 Apr 2022 07:10:14 -0400 Subject: [PATCH 198/225] for color update --- share/mutt-wizard.muttrc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/share/mutt-wizard.muttrc b/share/mutt-wizard.muttrc index f99d74d..3cefeeb 100644 --- a/share/mutt-wizard.muttrc +++ b/share/mutt-wizard.muttrc @@ -161,10 +161,10 @@ color underline black default color normal default default # Regex highlighting: -color header blue default ".*" -color header brightmagenta default "^(From)" -color header brightcyan default "^(Subject)" +color header brightmagenta default "^From" +color header brightcyan default "^Subject" color header brightwhite default "^(CC|BCC)" +color header blue default ".*" color body brightred default "[\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+" # Email addresses color body brightblue default "(https?|ftp)://[\-\.,/%~_:?&=\#a-zA-Z0-9]+" # URL color body green default "\`[^\`]*\`" # Green text between ` and ` From 95687867d1795299625e1e3dc5cdc412155de879 Mon Sep 17 00:00:00 2001 From: Jakub Kaczor Date: Sat, 9 Apr 2022 17:33:02 +0200 Subject: [PATCH 199/225] Hard link the file instead of copying In the latest neomutt release (2022-04-08), neomutt/neomutt/pull/3267 is merged. Neomutt doesn't overwrite files with zeros on closing anymore, just unlinks it. Therefore, instead of copying, files can be hard linked. --- bin/openfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/openfile b/bin/openfile index cf3c6c3..5a250dc 100755 --- a/bin/openfile +++ b/bin/openfile @@ -5,6 +5,6 @@ tempdir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard/files" file="$tempdir/$(basename "$1")" [ "$(uname)" = "Darwin" ] && opener="open" || opener="setsid -f xdg-open" mkdir -p "$tempdir" -cp -f "$1" "$file" +ln "$1" "$file" $opener "$file" >/dev/null 2>&1 find "${tempdir:?}" -mtime +1 -type f -delete From c7524bdd964b195ef67c40c38aba4e0501af24ef Mon Sep 17 00:00:00 2001 From: Jakub Kaczor Date: Sat, 9 Apr 2022 17:52:52 +0200 Subject: [PATCH 200/225] Force hard linking the file It was forgotten to add `-f` (force) option for `ln` in 95687867d1795299625e1e3dc5cdc412155de879. This enables opening files with the same names, but different contents, with a new NeoMutt instance, after the previous is closed. --- bin/openfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/openfile b/bin/openfile index 5a250dc..a351f75 100755 --- a/bin/openfile +++ b/bin/openfile @@ -5,6 +5,6 @@ tempdir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard/files" file="$tempdir/$(basename "$1")" [ "$(uname)" = "Darwin" ] && opener="open" || opener="setsid -f xdg-open" mkdir -p "$tempdir" -ln "$1" "$file" +ln -f "$1" "$file" $opener "$file" >/dev/null 2>&1 find "${tempdir:?}" -mtime +1 -type f -delete From 32d63b12dbda5fc2590176e1a99c7376e0395dc3 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Wed, 20 Apr 2022 14:19:48 -0400 Subject: [PATCH 201/225] Revert "Hard link the file instead of copying" This reverts commit 95687867d1795299625e1e3dc5cdc412155de879. --- bin/openfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/openfile b/bin/openfile index a351f75..cf3c6c3 100755 --- a/bin/openfile +++ b/bin/openfile @@ -5,6 +5,6 @@ tempdir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard/files" file="$tempdir/$(basename "$1")" [ "$(uname)" = "Darwin" ] && opener="open" || opener="setsid -f xdg-open" mkdir -p "$tempdir" -ln -f "$1" "$file" +cp -f "$1" "$file" $opener "$file" >/dev/null 2>&1 find "${tempdir:?}" -mtime +1 -type f -delete From 22fc8cfdea1d22692b375f8523bcd421b283978c Mon Sep 17 00:00:00 2001 From: "Gunnar K. Halvorsen" Date: Fri, 29 Apr 2022 13:55:42 +0200 Subject: [PATCH 202/225] Added domain --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index e0aa74c..35ba10b 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -100,6 +100,7 @@ etu.sorbonne-universite.fr,imaps.sorbonne-universite.fr,993,smtps.sorbonne-unive etu.upmc.fr,imaps.sorbonne-universite.fr,993,smtps.sorbonne-universite.fr,465 europe.com,imap.mail.com,993,smtp.mail.com,587 ex-studenti.unitn.it,imap.gmail.com,993,smtp.gmail.com,587 +faks.no,mail.uniweb.no,993,mail.uniweb.no,465 fastmail.com,imap.fastmail.com,993,smtp.fastmail.com,465 fastmail.fm,imap.fastmail.com,993,smtp.fastmail.com,465 fct.unl.pt,imap.gmail.com,993,smtp.gmail.com,587 From 480fc82f9b7f222c5fdf5da43e22a1518899aa8f Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 29 Apr 2022 14:49:11 -0400 Subject: [PATCH 203/225] openfile moved to lib, not for sole running --- Makefile | 10 +++++++--- share/mailcap | 6 +++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 03e2df1..569cd35 100644 --- a/Makefile +++ b/Makefile @@ -10,8 +10,10 @@ endif install: mkdir -p $(DESTDIR)$(PREFIX)/bin + mkdir -p $(DESTDIR)$(PREFIX)/lib/mutt-wizard cp -f bin/mw bin/mailsync bin/openfile $(DESTDIR)$(PREFIX)/bin/ - chmod 755 $(DESTDIR)$(PREFIX)/bin/mw $(DESTDIR)$(PREFIX)/bin/mailsync $(DESTDIR)$(PREFIX)/bin/openfile + cp -f bin/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 chmod 755 $(DESTDIR)$(PREFIX)/share/mutt-wizard cp -f share/mailcap share/domains.csv share/mutt-wizard.muttrc share/switch.muttrc $(DESTDIR)$(PREFIX)/share/mutt-wizard @@ -26,11 +28,13 @@ install: 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 uninstall: - rm -f $(DESTDIR)$(PREFIX)/bin/mw $(DESTDIR)$(PREFIX)/bin/mailsync $(DESTDIR)$(PREFIX)/bin/openfile - rm -rf $(DESTDIR)$(PREFIX)/share/mutt-wizard + rm -f $(DESTDIR)$(PREFIX)/bin/mw $(DESTDIR)$(PREFIX)/bin/mailsync $(DESTDIR)$(PREFIX)/lib/mutt-wizard/openfile + rm -rf $(DESTDIR)$(PREFIX)/share/mutt-wizard $(DESTDIR)$(PREFIX)/lib/mutt-wizard rm -f $(DESTDIR)$(MANPREFIX)/man1/mw.1 .PHONY: install uninstall diff --git a/share/mailcap b/share/mailcap index a49145f..0829b3b 100644 --- a/share/mailcap +++ b/share/mailcap @@ -1,9 +1,9 @@ text/plain; $EDITOR %s ; -text/html; openfile %s ; nametemplate=%s.html +text/html; /usr/local/lib/mutt-wizard/openfile %s ; nametemplate=%s.html text/html; lynx -assume_charset=%{charset} -display_charset=utf-8 -dump -width=1024 %s; nametemplate=%s.html; copiousoutput; -image/*; openfile %s ; +image/*; /usr/local/lib/mutt-wizard/openfile %s ; video/*; setsid mpv --quiet %s &; copiousoutput audio/*; mpv %s ; -application/pdf; openfile %s ; +application/pdf; /usr/local/lib/mutt-wizard/openfile %s ; application/pgp-encrypted; gpg -d '%s'; copiousoutput; application/pgp-keys; gpg --import '%s'; copiousoutput; From 5ae4758790603dc28a3a1bf8c21a991850b892ab Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 29 Apr 2022 15:11:16 -0400 Subject: [PATCH 204/225] mailsync manual per debian requirements --- Makefile | 5 +++-- bin/mailsync | 6 ++++-- mailsync.1 | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++ mw.1 | 1 + 4 files changed, 68 insertions(+), 4 deletions(-) create mode 100644 mailsync.1 diff --git a/Makefile b/Makefile index 569cd35..b84dff1 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,8 @@ install: chmod 644 $(DESTDIR)$(PREFIX)/share/mutt-wizard/mailcap $(DESTDIR)$(PREFIX)/share/mutt-wizard/domains.csv $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrc $(DESTDIR)$(PREFIX)/share/mutt-wizard/switch.muttrc mkdir -p $(DESTDIR)$(MANPREFIX)/man1 cp -f mw.1 $(DESTDIR)$(MANPREFIX)/man1/mw.1 - chmod 644 $(DESTDIR)$(MANPREFIX)/man1/mw.1 + cp -f mailsync.1 $(DESTDIR)$(MANPREFIX)/man1/mailsync.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; \ @@ -35,6 +36,6 @@ install: uninstall: rm -f $(DESTDIR)$(PREFIX)/bin/mw $(DESTDIR)$(PREFIX)/bin/mailsync $(DESTDIR)$(PREFIX)/lib/mutt-wizard/openfile rm -rf $(DESTDIR)$(PREFIX)/share/mutt-wizard $(DESTDIR)$(PREFIX)/lib/mutt-wizard - rm -f $(DESTDIR)$(MANPREFIX)/man1/mw.1 + rm -f $(DESTDIR)$(MANPREFIX)/man1/mw.1 $(DESTDIR)$(MANPREFIX)/man1/mailsync.1 .PHONY: install uninstall diff --git a/bin/mailsync b/bin/mailsync index e939b78..97cd224 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -30,6 +30,8 @@ export GPG_TTY="$(tty)" [ -n "$MBSYNCRC" ] && alias mbsync="mbsync -c $MBSYNCRC" || MBSYNCRC="$HOME/.mbsyncrc" +lastrun="${XDG_CONFIG_HOME:-$HOME/.config}/mutt/.mailsynclastrun" + # Settings are different for MacOS (Darwin) systems. case "$(uname)" in Darwin) @@ -60,7 +62,7 @@ syncandnotify() { "$HOME/.local/share/mail/$acc/INBOX/cur/"\ "$HOME/.local/share/mail/$acc/Inbox/cur/"\ "$HOME/.local/share/mail/$acc/inbox/cur/"\ - -type f -newer "${XDG_CONFIG_HOME:-$HOME/.config}/mutt/.mailsynclastrun" 2> /dev/null) + -type f -newer "$lastrun" 2> /dev/null) newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l) case 1 in $((newcount > 0)) ) notify "$acc" "$newcount" ;; @@ -87,4 +89,4 @@ wait notmuch new 2>/dev/null #Create a touch file that indicates the time of the last run of mailsync -touch "${XDG_CONFIG_HOME:-$HOME/.config}/mutt/.mailsynclastrun" +touch "$lastrun" diff --git a/mailsync.1 b/mailsync.1 new file mode 100644 index 0000000..98d6a39 --- /dev/null +++ b/mailsync.1 @@ -0,0 +1,60 @@ +.TH MW 1 mailsync +.SH NAME +mailsync \- sync mail accounts set up with +.B mw. +.SH SYNOPSIS +.B mailsync +[ +.I OPTIONS +]... [ +.I ACCOUNTS +] +.SH DESCRIPTION +.B mailsync +syncs the mail of all accounts set up with +.B +mw, +or if account names are given, syncs only those accounts. + +.B +mailsync +can also pass on options to +.B +mbsync, +which it uses to sync mail. +.B +mailsync +is a wrapper for +.B mbsync, +but also automatically reindexes new mail with +.B notmuch, +gives notifications if new mail is found and can also be set as a cronjob to sync and index mail quietly in the background. +.SH COMMANDS +.TP +.B mailsync +sync all mail accounts and notify user if there is new mail +.TP +.B mailsync account@example.org +only sync the +.B account@example.org +account. +.TP +.B +-* +See the +.B +mbsync +manual for aditional options that can be used. +.SH AUTHORS +Written by Luke Smith originally in 2018. +.SH LICENSE +GPLv3 +.SH SEE ALSO +.BR mw (1), +.BR neomutt (1), +.BR neomuttrc (1) +.BR mbsync (1), +.BR mpop (1), +.BR msmtp (1), +.BR notmuch (1), +.BR abook (1) diff --git a/mw.1 b/mw.1 index 4bdb383..2172f80 100644 --- a/mw.1 +++ b/mw.1 @@ -296,6 +296,7 @@ Written by Luke Smith originally in 2018. .SH LICENSE GPLv3 .SH SEE ALSO +.BR mailsync (1), .BR neomutt (1), .BR neomuttrc (1) .BR mbsync (1), From dcbaab19aa502a0d049f6045b18f567ce16bf20f Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 29 Apr 2022 15:13:48 -0400 Subject: [PATCH 205/225] dumb --- mailsync.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mailsync.1 b/mailsync.1 index 98d6a39..e2e1153 100644 --- a/mailsync.1 +++ b/mailsync.1 @@ -1,4 +1,4 @@ -.TH MW 1 mailsync +.TH MAILSYNC 1 .SH NAME mailsync \- sync mail accounts set up with .B mw. From 4911a7eff3471a144f7ea590bf6936cbd51d5689 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sat, 30 Apr 2022 09:57:57 -0400 Subject: [PATCH 206/225] openfile to lib --- Makefile | 4 ++-- {bin => lib}/openfile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename {bin => lib}/openfile (91%) diff --git a/Makefile b/Makefile index b84dff1..0b610be 100644 --- a/Makefile +++ b/Makefile @@ -11,8 +11,8 @@ endif install: mkdir -p $(DESTDIR)$(PREFIX)/bin mkdir -p $(DESTDIR)$(PREFIX)/lib/mutt-wizard - cp -f bin/mw bin/mailsync bin/openfile $(DESTDIR)$(PREFIX)/bin/ - cp -f bin/openfile $(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 chmod 755 $(DESTDIR)$(PREFIX)/share/mutt-wizard diff --git a/bin/openfile b/lib/openfile similarity index 91% rename from bin/openfile rename to lib/openfile index cf3c6c3..0f60b10 100755 --- a/bin/openfile +++ b/lib/openfile @@ -2,7 +2,7 @@ # Helps open a file with xdg-open from mutt in a external program without weird side effects. tempdir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard/files" -file="$tempdir/$(basename "$1")" +file="$tempdir/${1##*/}" [ "$(uname)" = "Darwin" ] && opener="open" || opener="setsid -f xdg-open" mkdir -p "$tempdir" cp -f "$1" "$file" From b4b1323a25474864730e0159c9f29c1b96712529 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sat, 30 Apr 2022 09:58:56 -0400 Subject: [PATCH 207/225] sort --- share/domains.csv | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/domains.csv b/share/domains.csv index 35ba10b..adbe06d 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -163,7 +163,7 @@ live.rhul.ac.uk,outlook.office365.com,993,smtp.office365.com,587 logorroici.org,mail.autistici.org,993,smtp.autistici.org,465 loves.dicksinhisan.us,mail.cock.li,993,mail.cock.li,587 loves.dicksinmyan.us,mail.cock.li,993,mail.cock.li,587 -lukesmith.xyz,mail.lukesmith.xyz,993,mail.lukesmith.xyz,465 +lukesmith.xyz,mail.cedars.xyz,993,mail.cedars.xyz,465 luther.edu,imap.gmail.com,993,smtp.gmail.com,587 mac.com,imap.mail.me.com,993,smtp.mail.me.com,587 mace.ac.in,imap.gmail.com,993,smtp.gmail.com,587 @@ -243,6 +243,7 @@ sheridancollege.ca,outlook.office365.com,993,smtp.office365.com,587 shu.edu.cn,imap.shu.edu.cn,143,smtp.shu.edu.cn,25 sina.cn,imap.sina.cn,993,smtp.sina.cn,587 sina.com,imap.sina.com,993,smtp.sina.com,587 +sis.hust.edu.vn,outlook.office365.com,993,smtp.office365.com,587 smail.inf.h-brs.de,imap.inf.h-brs.de,993,smtp.inf.h-brs.de,587 sms.ed.ac.uk,pod51015.outlook.com,993,pod51015.outlook.com,587 snopyta.org,mail.snopyta.org,993,mail.snopyta.org,465 @@ -332,4 +333,3 @@ zaclys.net,mail.zaclys.net,993,mail.zaclys.net,465 zju.edu.cn,imap.zju.edu.cn,993,smtp.zju.edu.cn,994 zoho.com,imap.zoho.com,993,smtp.zoho.com,465 zohomail.eu,imap.zoho.eu,993,smtp.zoho.eu,465 -sis.hust.edu.vn,outlook.office365.com,993,smtp.office365.com,587 From 04a1e46ee1dfe1787b62e4402048ce75f08df1e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Battistella=20Nadas?= Date: Tue, 3 May 2022 09:10:16 +0200 Subject: [PATCH 208/225] added domain for freedom.nl --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index adbe06d..aedb0d6 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -107,6 +107,7 @@ fct.unl.pt,imap.gmail.com,993,smtp.gmail.com,587 firemail.cc,mail.cock.li,993,mail.cock.li,587 forpsi.com,imap.forpsi.com,993,smtp.forpsi.com,465 forthnet.gr,mail.forthnet.gr,993,smtp-auth.forthnet.gr,465 +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 From e1d47ea4830a41220e0a9754ad61bd71bcd81d51 Mon Sep 17 00:00:00 2001 From: rl Date: Fri, 13 May 2022 17:40:35 +0300 Subject: [PATCH 209/225] added encryption shortcut in neomutt interface description --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7626e4d..479870f 100644 --- a/README.md +++ b/README.md @@ -127,6 +127,7 @@ To give you an example of the interface, here's an idea: - `?` - see all keyboard shortcuts - `ctrl-j`/`ctrl-k` - move up and down in sidebar, `ctrl-o` opens mailbox. - `ctrl-b` - open a menu to select a URL you want to open in your browser. +- `p` - before sending mail choose to encrypt/sign your message ## Additional functionality From 162441dde07cf9c811085f3dbb7fee2ce4fa3522 Mon Sep 17 00:00:00 2001 From: rickylinden <59360547+rickylinden@users.noreply.github.com> Date: Fri, 13 May 2022 17:45:43 +0300 Subject: [PATCH 210/225] Update README.md Clearer description of encryption shortcut. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 479870f..b634fc7 100644 --- a/README.md +++ b/README.md @@ -127,7 +127,7 @@ To give you an example of the interface, here's an idea: - `?` - see all keyboard shortcuts - `ctrl-j`/`ctrl-k` - move up and down in sidebar, `ctrl-o` opens mailbox. - `ctrl-b` - open a menu to select a URL you want to open in your browser. -- `p` - before sending mail choose to encrypt/sign your message +- `p` - encrypt/sign your message (in compose view, before sending the email). ## Additional functionality From 7c4f552cfb566d2244239e616b1c0afb79db8fc0 Mon Sep 17 00:00:00 2001 From: Gil Oliveira Date: Sun, 22 May 2022 19:37:36 +0100 Subject: [PATCH 211/225] Add purelymail.com to domains.csv --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index adbe06d..bba5bf9 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -228,6 +228,7 @@ privacyrequired.com,mail.autistici.org,993,smtp.autistici.org,465 prokonto.pl,poczta.o2.pl,993,poczta.o2.pl,465 protonmail.ch,127.0.0.1,1143,127.0.0.1,1025 protonmail.com,127.0.0.1,1143,127.0.0.1,1025 +purelymail.com,imap.purelymail.com,993,smtp.purelymail.com,465 pwned.life,imap.nixnet.email,143,smtp.nixnet.email,587 qq.com,imap.qq.com,993,smtp.qq.com,587 rape.lol,mail.cock.li,993,mail.cock.li,587 From f2014408b984c7e5814d1021cab55624cbed7ae6 Mon Sep 17 00:00:00 2001 From: Kr1ss Date: Tue, 31 May 2022 18:19:40 +0200 Subject: [PATCH 212/225] fix notifications when the Xorg process is just X To close #845 : I added the `-x` flag to prevent the regex from matching on _every_ pro- cess name containing an `X`. Because I'm not entirely sure about portability (does every `pgrep` va- riant support that flag), I didn't push this directly. So what do you think @LukeSmithxyz ? --- bin/mailsync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mailsync b/bin/mailsync index 97cd224..2f32c14 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -42,7 +42,7 @@ case "$(uname)" in *systemd*|*openrc*) export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus ;; esac # remember if a display server is running since `ps` doesn't always contain a display - pgrepoutput="$(pgrep -a X\(org\|wayland\))" + pgrepoutput="$(pgrep -ax X\(\|org\|wayland\))" displays="$(echo "$pgrepoutput" | grep -wo "[0-9]*:[0-9]\+" | sort -u)" notify() { [ -n "$pgrepoutput" ] && for x in ${displays:-0:}; do export DISPLAY=$x From 3a2f4a55fa966a6c095639193cb9ab1f3a3d8229 Mon Sep 17 00:00:00 2001 From: f380cedric Date: Fri, 10 Jun 2022 18:16:29 +0200 Subject: [PATCH 213/225] Fix: find & case-insensitive filesystem On case-insensitive filesystem, `inbox` and `Inbox` are the same path. Running `find Inbox inbox [expr]` will print twice the same information. Use shell glob instead: `find` will descend into path `inbox`, ignoring letter cases, only once. Fix #828. --- bin/mailsync | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/bin/mailsync b/bin/mailsync index 2f32c14..0d2983f 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -56,12 +56,8 @@ syncandnotify() { acc="$(echo "$account" | sed "s/.*\///")" if [ -z "$opts" ]; then mbsync "$acc"; else mbsync "$opts" "$acc"; fi new=$(find\ - "$HOME/.local/share/mail/$acc/INBOX/new/"\ - "$HOME/.local/share/mail/$acc/Inbox/new/"\ - "$HOME/.local/share/mail/$acc/inbox/new/"\ - "$HOME/.local/share/mail/$acc/INBOX/cur/"\ - "$HOME/.local/share/mail/$acc/Inbox/cur/"\ - "$HOME/.local/share/mail/$acc/inbox/cur/"\ + "$HOME/.local/share/mail/$acc/"[Ii][Nn][Bb][Oo][Xx]/new/\ + "$HOME/.local/share/mail/$acc/"[Ii][Nn][Bb][Oo][Xx]/cur/\ -type f -newer "$lastrun" 2> /dev/null) newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l) case 1 in From 72fcb51e2434afe4e672019c5fce08d7fdfa8b86 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Tue, 14 Jun 2022 07:45:16 -0600 Subject: [PATCH 214/225] remove harmless sed error msg if no muttrc --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mw b/bin/mw index 04361fc..d8d4d73 100755 --- a/bin/mw +++ b/bin/mw @@ -224,7 +224,7 @@ 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" | 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 From ef8cda91cf58be7eec314b4752a4085f4afbec3a Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Tue, 21 Jun 2022 12:59:23 -0400 Subject: [PATCH 215/225] fix #792, fix #820 --- share/mutt-wizard.muttrc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/share/mutt-wizard.muttrc b/share/mutt-wizard.muttrc index 3cefeeb..4df16a4 100644 --- a/share/mutt-wizard.muttrc +++ b/share/mutt-wizard.muttrc @@ -57,8 +57,10 @@ bind index,query tag-entry macro browser h '..' "Go to parent folder" bind index,pager H view-raw-message bind browser l select-entry -bind pager,browser gg top-page -bind pager,browser G bottom-page +bind browser gg top-page +bind browser G bottom-page +bind pager gg top +bind pager G bottom bind index,pager,browser d half-down bind index,pager,browser u half-up bind index,pager S sync-mailbox From 367c10ec3f16c3c11e1a5de980bc95dd4fa6bf79 Mon Sep 17 00:00:00 2001 From: jw Date: Fri, 1 Jul 2022 00:12:04 +0200 Subject: [PATCH 216/225] Silence mailsync, so cron doesn't spam e-mails on every update --- bin/mailsync | 7 +++---- bin/mw | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/bin/mailsync b/bin/mailsync index 2f32c14..6aba835 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -70,14 +70,13 @@ syncandnotify() { } # Sync accounts passed as argument or all. -if [ "$#" -eq "0" ]; then - accounts="$(awk '/^Channel/ {print $2}' "$MBSYNCRC")" -else +if [ "$#" -gt "0" ]; then for arg in "$@"; do [ "${arg%${arg#?}}" = '-' ] && opts="${opts:+${opts} }${arg}" && shift 1 done accounts=$* fi +[[ ! $accounts ]] && accounts="$(awk '/^Channel/ {print $2}' "$MBSYNCRC")" # Parallelize multiple accounts for account in $accounts; do @@ -86,7 +85,7 @@ done wait -notmuch new 2>/dev/null +notmuch new --quiet #Create a touch file that indicates the time of the last run of mailsync touch "$lastrun" diff --git a/bin/mw b/bin/mw index d8d4d73..8a89a17 100755 --- a/bin/mw +++ b/bin/mw @@ -262,7 +262,7 @@ togglecron() { cron="$(mktemp)" 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 -q" >> "$cron" fi && crontab "$cron"; rm -f "$cron" ;} From ef5bac2b55e3bd665d103eff4ea435ecaa9db22c Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 1 Jul 2022 09:38:07 -0400 Subject: [PATCH 217/225] remove Protonmail support. POP server now -p --- README.md | 14 ++------------ bin/mw | 17 +++-------------- mw.1 | 8 +------- share/domains.csv | 3 --- 4 files changed, 6 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index b634fc7..90243b6 100644 --- a/README.md +++ b/README.md @@ -99,11 +99,10 @@ The mutt-wizard runs via the command `mw`. Once setup is complete, you'll use #### General Settings -- `-p` -- Add a Protonmail account. - `-f` -- Assume mailbox names and force account configuration without connecting online at all. - `-o` -- Configure mutt for an account, but do not keep mail offline. -- `-P` -- Use POP protocol instead of IMAP (requires `mpop` installed). +- `-p` -- Use POP protocol instead of IMAP (requires `mpop` installed). ## Neomutt user interface @@ -168,7 +167,7 @@ To give you an example of the interface, here's an idea: errors generally. - Addition of a manual `man mw` - Now handles POP protocol via `mpop` for those who prefer it (add an account - with the `-P` option). POP configs are still generated automatically. + with the `-p` option). POP configs are still generated automatically. ## Help the Project! @@ -205,15 +204,6 @@ See Luke's website [here](https://lukesmith.xyz). Email him at applications requires turning off two-factor authentication and this will circumvent that. You might also need to manually "Enable IMAP" in the settings. -- Protonmail accounts require a "Protonmail Bridge" to access - PM's IMAP and SMTP servers. Configure that before running mutt-wizard. Note - that when mutt-wizard asks for a password, you should put in your - [bridge password](https://protonmail.com/bridge/thunderbird#3), not your - account password. -- Protonmail bridge is prone to timing out. Watch out for this while adding an - account. If the bridge times out, try again. It might help to - [increase the timeout](https://protonmail.com/support/knowledge-base/thunderbird-connection-server-timed-error/) - in your `mbsyncrc`. - 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. diff --git a/bin/mw b/bin/mw index d8d4d73..f0b46e2 100755 --- a/bin/mw +++ b/bin/mw @@ -297,8 +297,7 @@ Options allowed with -a: -s SMTP server address -S SMTP server port -x Password for account (recommended to be in double quotes) - -p Install for a Protonmail account. - -P Add for a POP server instead of IMAP. + -p Add for a POP server instead of IMAP. -X Delete an account's local email too when deleting. -o Configure address, but keep mail online. -f Assume typical English mailboxes without attempting log-on. @@ -333,7 +332,7 @@ reorder() { ' "$tempfile" >> "$muttrc" } -while getopts "rfpPXlhodTYD:y:i:I:s:S:u:a:n:x:m:t:" o; do case "${o}" in +while getopts "rfpXlhodTYD:y:i:I:s:S:u:a:n:x:m:t:" o; do case "${o}" in l) setact list || exit 1 ;; r) setact reorder || exit 1 ;; d) setact delete || exit 1 ;; @@ -349,22 +348,12 @@ while getopts "rfpPXlhodTYD:y:i:I:s:S:u:a:n:x:m:t:" o; do case "${o}" in n) setact add || exit 1 ; realname="$OPTARG" ;; m) setact add || exit 1 ; maxmes="$OPTARG" ;; o) setact add || exit 1 ; type="online" ;; - P) setact add || exit 1 ; type="pop"; protocol="pop3s" ; iport="${iport:-995}" ;; + p) setact add || exit 1 ; type="pop"; protocol="pop3s" ; iport="${iport:-995}" ;; f) setact add || exit 1 ; force=True ;; x) setact add || exit 1 ; password="$OPTARG" ;; X) setact delete || exit 1 ; purge=True ;; t) setact toggle || exit 1 ; cronmin="$OPTARG" ;; T) setact toggle || exit 1 ;; - p) echo "NOTE: Protonmail users must install and configure Protonmail Bridge first for the first sync to work." - protocol="imap" - imap="127.0.0.1" - iport="1143" - smtp="127.0.0.1" - sport="1025" - auth="login" - tlsline="tls_fingerprint $(msmtp --serverinfo --host=$smtp --port=$sport --tls --tls-certcheck=off | sed -n '/SHA256:/ s/^\s*SHA256:\s*// p')" - setact add || exit 1 - ;; *) mwinfo; exit 1 ;; esac done diff --git a/mw.1 b/mw.1 index 2172f80..c3cbd07 100644 --- a/mw.1 +++ b/mw.1 @@ -80,9 +80,6 @@ Create settings for an account to be used online only without mail syncing abili .B -f connection will still be attempted in setup to discover mailboxes. .TP -.B -p -Add a Protonmail account. Protonmail Bridge must be installed and set up. -.TP .B -X When removing an email profile with either .I -d @@ -90,7 +87,7 @@ or .I -D, also delete the local mail (will not delete the mail on the server). .TP -.B -P +.B -p Use POP protocol instead of IMAP. Requires .I mpop to download mail after configuration. Server details can still be given with the @@ -155,9 +152,6 @@ on mutt-wizard's Github or Gitlab .B Gmail accounts Google will require you to allow "less-secure" (third party) applications or remove two-factor authentication in order to access their IMAP servers to download your mail. If you use Gmail, be sure to handle this before running mutt-wizard . .TP -.B Protonmail accounts -Protonmail users must use the Protonmail Bridge to access their IMAP and SMTP servers. This too should be configured before running mutt-wizard. -.TP .B Enterprise and university accounts Many universities and businesses might host their domain's email via Google or another service. This often requires a special IMAP/SMTP-specific password that you must generate and use. Again, mutt-wizard can handle these systems, but only once they've been set up. .TP diff --git a/share/domains.csv b/share/domains.csv index be0086e..77a20af 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -217,7 +217,6 @@ parabolas.xyz,mail.parabolas.xyz,993,mail.parabolas.xyz,587 paranoici.org,mail.autistici.org,993,smtp.autistici.org,465 paranoid.email,imap.paranoid.email,993,smtp.paranoid.email,25 paranoid.network,imap.nixnet.email,143,smtp.nixnet.email,587 -pm.me,127.0.0.1,1143,127.0.0.1,1025 poczta.fm,poczta.interia.pl,993,poczta.interia.pl,465 poczta.onet.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465 polimi.it,outlook.office365.com,993,smtp.office365.com,587 @@ -227,8 +226,6 @@ posteo.*,posteo.de,993,posteo.de,587 privacy.xyz,imap.nixnet.email,143,smtp.nixnet.email,587 privacyrequired.com,mail.autistici.org,993,smtp.autistici.org,465 prokonto.pl,poczta.o2.pl,993,poczta.o2.pl,465 -protonmail.ch,127.0.0.1,1143,127.0.0.1,1025 -protonmail.com,127.0.0.1,1143,127.0.0.1,1025 purelymail.com,imap.purelymail.com,993,smtp.purelymail.com,465 pwned.life,imap.nixnet.email,143,smtp.nixnet.email,587 qq.com,imap.qq.com,993,smtp.qq.com,587 From caf2681891eb3fbe04bd10ba30369ffe8e8616d4 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 1 Jul 2022 10:00:34 -0400 Subject: [PATCH 218/225] remove bashism --- bin/mailsync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mailsync b/bin/mailsync index 6aba835..f100cd0 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -76,7 +76,7 @@ if [ "$#" -gt "0" ]; then done accounts=$* fi -[[ ! $accounts ]] && accounts="$(awk '/^Channel/ {print $2}' "$MBSYNCRC")" +[ -z "$accounts" ] && accounts="$(awk '/^Channel/ {print $2}' "$MBSYNCRC")" # Parallelize multiple accounts for account in $accounts; do From 30c1c0d2ae1ea4439986b1868557bbd2cc9e297a Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 1 Jul 2022 17:35:52 -0400 Subject: [PATCH 219/225] fix #785 since cron now silent --- bin/mailsync | 2 -- 1 file changed, 2 deletions(-) diff --git a/bin/mailsync b/bin/mailsync index f100cd0..c924de5 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -11,8 +11,6 @@ # issues. It also should at least be compatible with Linux (and maybe BSD) with # Xorg and MacOS as well. -# Run only if user logged in (prevent cron errors) -pgrep -u "${USER:=$LOGNAME}" >/dev/null || { echo "$USER not logged in; sync will not run."; exit ;} # Run only if not already running in other instance pgrep mbsync >/dev/null && { echo "mbsync is already running."; exit ;} From 2aae3860a2531c872ac69285da2b52801b73e864 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 1 Jul 2022 18:30:29 -0400 Subject: [PATCH 220/225] rm paypal crap, replace with xmr/btc. add website. --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 90243b6..9ec4f31 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # mutt-wizard +https://muttwizard.com/ + Get this great stuff without effort: - A full-featured and autoconfigured email client on the terminal with neomutt @@ -176,10 +178,9 @@ To give you an example of the interface, here's an idea: errors. - Open a PR to add new server information into `domains.csv` so their users can more easily use mutt-wizard. -- If nothing else, [Donate!](https://paypal.me/LukeMSmith) - -See Luke's website [here](https://lukesmith.xyz). Email him at -[luke@lukesmith.xyz](mailto:luke@lukesmith.xyz). +- If nothing else, donate: + - XMR: `8AzeWXhJvYJ1VeENHcNXCR1dLMgDALreZ1BdooZVjRKndv6myr3t1ue6C4ML2an5fWSpcP1sTDA9nKUMevkukDXG6chRjNv` + - BTC: `bc1qacqfp36ffv9mafechmvk8f6r8qy4tual6rcm9p` ## Details for Tinkerers From 315069b5a27a7965dfa9efb5778ddaa6421e02eb Mon Sep 17 00:00:00 2001 From: Lokesh Mohanty Date: Sat, 2 Jul 2022 21:46:54 +0530 Subject: [PATCH 221/225] pass: add feature to optionally add a prefix --- bin/mw | 29 ++++++++++++++++------------- mw.1 | 2 ++ 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/bin/mw b/bin/mw index c71d662..cd5235c 100755 --- a/bin/mw +++ b/bin/mw @@ -43,7 +43,7 @@ host $smtp port ${sport:-465} from $fulladdr user $login -passwordeval \"pass $fulladdr\" +passwordeval \"pass $passprefix$fulladdr\" auth ${auth:-on} tls on tls_trust_file $sslcert @@ -58,7 +58,7 @@ IMAPStore $fulladdr-remote Host $imap Port ${iport:-993} User $login -PassCmd \"pass $fulladdr\" +PassCmd \"pass $passprefix$fulladdr\" AuthMechs LOGIN SSLType ${imapssl:-IMAPS} CertificateFile $sslcert @@ -87,7 +87,7 @@ tls on user $login host $imap delivery maildir ${XDG_DATA_HOME:-$HOME/.local/share}/mail/$fulladdr/${inbox:-INBOX} -passwordeval pass $fulladdr +passwordeval pass $passprefix$fulladdr " >> "$mpoprc" ;} prepmutt() { echo "# vim: filetype=neomuttrc @@ -128,7 +128,7 @@ getprofiles() { \ case "$type" in online) folder="imaps://$login@$imap:${iport:-993}" extra="set imap_user = \"$login\" -set imap_pass = \"\`pass $fulladdr\`\" +set imap_pass = \"\`pass $passprefix$fulladdr\`\" set ssl_starttls = yes set ssl_force_tls = yes" ;; @@ -176,7 +176,7 @@ delete() { if [ -z "${fulladdr+x}" ]; then 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 "$fulladdr" >/dev/null 2>&1 + pass rm -f "$passprefix$fulladdr" >/dev/null 2>&1 [ -n "${purge+x}" ] && rm -rf "${maildir:?}/${fulladdr:?}" for file in "$msmtprc" "$mbsyncrc" "$mpoprc"; do @@ -200,6 +200,7 @@ askinfo() { \ read -r smtp [ "$sport" = 587 ] && tlsline="# tls_starttls" [ -z "$realname" ] && realname="${fulladdr%%@*}" + [ -z "$passprefix" ] && passprefix="" hostname="${fulladdr#*@}" login="${login:-$fulladdr}" if [ -n "${password+x}" ]; then @@ -209,17 +210,17 @@ askinfo() { \ fi } -createpass() { echo "$password" > "$PASSWORD_STORE_DIR/$fulladdr" - "$GPG" -qe $(printf -- " -r %s" $(cat "$PASSWORD_STORE_DIR/.gpg-id")) "$PASSWORD_STORE_DIR/$fulladdr" - rm -f "$PASSWORD_STORE_DIR/$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" + rm -f "$PASSWORD_STORE_DIR/$passprefix$fulladdr" ;} -getpass() { while : ; do pass rm -f "$fulladdr" >/dev/null 2>&1 - pass insert -f "$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 mailboxes="$(printf "INBOX\\nDrafts\\nJunk\\nTrash\\nSent\\nArchive")" else - info="$(curl --location-trusted -s -m 5 --user "$login:$(pass "$fulladdr")" --url "${protocol:-imaps}://$imap:${iport:-993}")" + info="$(curl --location-trusted -s -m 5 --user "$login:$(pass "$passprefix$fulladdr")" --url "${protocol:-imaps}://$imap:${iport:-993}")" [ -z "$info" ] && echo "Log-on not successful." && return 1 mailboxes="$(echo "$info" | grep -v HasChildren | sed "s/.*\" //;s/\"//g" | tr -d '\r')" fi @@ -297,6 +298,7 @@ Options allowed with -a: -s SMTP server address -S SMTP server port -x Password for account (recommended to be in double quotes) + -P Pass Prefix (prefix of the file where password is stored) -p Add for a POP server instead of IMAP. -X Delete an account's local email too when deleting. -o Configure address, but keep mail online. @@ -305,7 +307,7 @@ Options allowed with -a: NOTE: Once at least one account is added, you can run \`mbsync -a\` to begin downloading mail. -To change an account's password, run \`pass edit your@email.com\`. +To change an account's password, run \`pass edit '$passprefix'your@email.com\`. EOF } @@ -332,7 +334,7 @@ reorder() { ' "$tempfile" >> "$muttrc" } -while getopts "rfpXlhodTYD:y:i:I:s:S:u:a:n:x:m:t:" o; do case "${o}" in +while getopts "rfpXlhodTYD:y:i:I:s:S:u:a:n:P:x:m:t:" o; do case "${o}" in l) setact list || exit 1 ;; r) setact reorder || exit 1 ;; d) setact delete || exit 1 ;; @@ -346,6 +348,7 @@ while getopts "rfpXlhodTYD:y:i:I:s:S:u:a:n:x:m:t:" o; do case "${o}" in S) setact add || exit 1 ; sport="$OPTARG" ;; u) setact add || exit 1 ; login="$OPTARG" ;; n) setact add || exit 1 ; realname="$OPTARG" ;; + P) setact add || exit 1 ; passprefix="$OPTARG" ;; m) setact add || exit 1 ; maxmes="$OPTARG" ;; o) setact add || exit 1 ; type="online" ;; p) setact add || exit 1 ; type="pop"; protocol="pop3s" ; iport="${iport:-995}" ;; diff --git a/mw.1 b/mw.1 index c3cbd07..e4755ba 100644 --- a/mw.1 +++ b/mw.1 @@ -70,6 +70,8 @@ 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. +.B -P +Pass Prefix. The password will be stored using pass at .SH OTHER OPTIONS .TP .B -f From 0b9135142a22dfc696628d620407e913cc58f778 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Mon, 4 Jul 2022 23:59:24 -0400 Subject: [PATCH 222/225] move msmtp cache and reorder prep --- bin/mw | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/mw b/bin/mw index c71d662..739d2bb 100755 --- a/bin/mw +++ b/bin/mw @@ -7,14 +7,13 @@ 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_CONFIG_HOME:-$HOME/.config}/msmtp/msmtp.log" +msmtplog="${XDG_CACHE_HOME:-$HOME/.cache}/msmtp/msmtp.log" mbsyncrc="${MBSYNCRC:-$HOME/.mbsyncrc}" mpoprc="${XDG_CONFIG_HOME:-$HOME/.config}/mpop/config" alias mbsync='mbsync -c "$mbsyncrc"' # On Ubuntu/Debian, a link is needed since they use an older version. if command -V apt-get >/dev/null 2>&1; then - ln -s "$msmtprc" "$HOME/.msmtprc" 2>/dev/null master="Master" slave="Slave" fi @@ -38,7 +37,9 @@ getaccounts() { accounts="$(find -L "$accdir" -type f 2>/dev/null | grep -o "\S* list() { getaccounts && [ -n "$accounts" ] && echo "$accounts" || exit 1 ;} -prepmsmtp() { echo "account $fulladdr +prepmsmtp() { mkdir -p "${msmtprc%/*}" "${msmtplog%/*}" + ln -s "$msmtprc" "$HOME/.msmtprc" 2>/dev/null + echo "account $fulladdr host $smtp port ${sport:-465} from $fulladdr @@ -90,7 +91,8 @@ delivery maildir ${XDG_DATA_HOME:-$HOME/.local/share}/mail/$fulladdr/${inbox:-IN passwordeval pass $fulladdr " >> "$mpoprc" ;} -prepmutt() { echo "# vim: filetype=neomuttrc +prepmutt() { mkdir -p "${muttrc%/*}" "${accdir%/*}" + echo "# vim: filetype=neomuttrc # muttrc file for account $fulladdr set realname = \"$realname\" set from = \"$fulladdr\" @@ -119,8 +121,6 @@ macro index \eh \"$prefix/libexec/gpg-wks-client --receive | msmtp } getprofiles() { \ - mkdir -p "${muttrc%/*}" "$accdir" "${XDG_CONFIG_HOME:-$HOME/.config}/msmtp" - unset msmtp_header msmtp_profile mutt_profile mbsync_profile case "$iport" in 1143) imapssl=None ;; 143) imapssl=STARTTLS ;; From 36c87c512ed0e5b2fd3e67b79711eaab555de5e3 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Tue, 5 Jul 2022 17:37:36 -0400 Subject: [PATCH 223/225] removed introduced bug, fix #861 --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mw b/bin/mw index f444cb7..52c46cc 100755 --- a/bin/mw +++ b/bin/mw @@ -91,7 +91,7 @@ delivery maildir ${XDG_DATA_HOME:-$HOME/.local/share}/mail/$fulladdr/${inbox:-IN passwordeval pass $passprefix$fulladdr " >> "$mpoprc" ;} -prepmutt() { mkdir -p "${muttrc%/*}" "${accdir%/*}" +prepmutt() { mkdir -p "${muttrc%/*}" "$accdir" echo "# vim: filetype=neomuttrc # muttrc file for account $fulladdr set realname = \"$realname\" From 3844aa140428d2e278b3848ad4785a90bf104f33 Mon Sep 17 00:00:00 2001 From: i-c-u-p <96894903+i-c-u-p@users.noreply.github.com> Date: Fri, 8 Jul 2022 02:51:11 -0500 Subject: [PATCH 224/225] put keyboard shortcuts in tag --- README.md | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 9ec4f31..7904bb5 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ A user of Arch-based distros can also install the current mutt-wizard release fr - `notmuch` - index and search mail. Install it and run `notmuch setup`, tell it that your mail is in `~/.local/share/mail/` (although `mw` will do this automatically if you haven't set notmuch up before). You can run it in mutt - with `ctrl-f`. Run `notmuch new` to process new mail. + with ctrl-f. Run `notmuch new` to process new mail. - `abook` - a terminal-based address book. Pressing tab while typing an address to send mail to will suggest contacts that are in your abook. - `urlview` - outputs urls in mail to browser. @@ -110,25 +110,25 @@ The mutt-wizard runs via the command `mw`. Once setup is complete, you'll use To give you an example of the interface, here's an idea: -- `m` - send mail (uses your default `$EDITOR` to write) -- `j`/`k` and `d`/`u` - vim-like bindings to go down and up (or `d`/`u` to go +- m - send mail (uses your default `$EDITOR` to write) +- j/k and d/u - vim-like bindings to go down and up (or d/u to go down/up a page). -- `l` - open mail, or attachment page or attachment -- `h` - the opposite of `l` -- `r`/`R` - reply/reply all to highlighted mail -- `s` - save selected mail or selected attachment -- `gs`,`gi`,`ga`,`gd`,`gS` - Press `g` followed by another letter to change - mailbox: `s`ent, `i`nbox, `a`rchive, `d`rafts, `S`pam, etc. -- `M` and `C` - For `M`ove and `C`opy: follow them with one of the mailbox - letters above, i.e. `MS` means "move to Spam". -- `i#` - Press `i` followed by a number 1-9 to go to a different account. If you +- l - open mail, or attachment page or attachment +- h - the opposite of l +- r/R - reply/reply all to highlighted mail +- s - save selected mail or selected attachment +- gs,gi,ga,gd,gS - Press g followed by another letter to change + mailbox: sent, inbox, archive, drafts, Spam, etc. +- M and C - For Move and Copy: follow them with one of the mailbox + letters above, i.e. MS means "move to Spam". +- i# - Press i followed by a number 1-9 to go to a different account. If you add 9 accounts via mutt-wizard, they will each be assigned a number. -- `a` to add address/person to abook and `Tab` while typing address to complete +- a to add address/person to abook and Tab while typing address to complete one from abook. -- `?` - see all keyboard shortcuts -- `ctrl-j`/`ctrl-k` - move up and down in sidebar, `ctrl-o` opens mailbox. -- `ctrl-b` - open a menu to select a URL you want to open in your browser. -- `p` - encrypt/sign your message (in compose view, before sending the email). +- ? - see all keyboard shortcuts +- ctrl-j/ctrl-k - move up and down in sidebar, ctrl-o opens mailbox. +- ctrl-b - open a menu to select a URL you want to open in your browser. +- p - encrypt/sign your message (in compose view, before sending the email). ## Additional functionality @@ -139,7 +139,7 @@ To give you an example of the interface, here's an idea: - `notmuch` - Index and search mail. Install it and run `notmuch setup`, tell it that your mail is in `~/.local/share/mail/` (although `mw` will do this automatically if you haven't set notmuch up before). You can run it in mutt - with `ctrl-f`. Run `notmuch new` to process new mail. + with ctrl-f. Run `notmuch new` to process new mail. - `abook` - A terminal-based address book. Pressing tab while typing an address to send mail to will suggest contacts that are in your abook. - `urlview` - Outputs URLs in an email to your browser. From e35a9686c9ca60fab62464b376ca295e2adfcaca Mon Sep 17 00:00:00 2001 From: Beau McCartney Date: Fri, 8 Jul 2022 11:41:17 -0600 Subject: [PATCH 225/225] Update domains.csv --- share/domains.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/share/domains.csv b/share/domains.csv index 77a20af..08a3a95 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -33,6 +33,7 @@ autograf.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465 autoproduzioni.net,mail.autistici.org,993,smtp.autistici.org,465 bartender.net,imap.mail.com,993,smtp.mail.com,587 bastardi.net,mail.autistici.org,993,smtp.autistici.org,465 +beaumccartney.xyz,mail.beaumccartney.xyz,993,mail.beaumccartney.xyz,465 bguth.de,wp300.webpack.hosteurope.de,993,wp300.webpack.hosteurope.de,587 bigpond.com,imap.telstra.com,143,smtp.telstra.com,587 bikerider.com,imap.mail.com,993,smtp.mail.com,587