From 72fcb51e2434afe4e672019c5fce08d7fdfa8b86 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Tue, 14 Jun 2022 07:45:16 -0600 Subject: remove harmless sed error msg if no muttrc --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin/mw') 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 -- cgit v1.2.3 From 367c10ec3f16c3c11e1a5de980bc95dd4fa6bf79 Mon Sep 17 00:00:00 2001 From: jw Date: Fri, 1 Jul 2022 00:12:04 +0200 Subject: 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(-) (limited to 'bin/mw') 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" ;} -- cgit v1.2.3 From ef5bac2b55e3bd665d103eff4ea435ecaa9db22c Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 1 Jul 2022 09:38:07 -0400 Subject: 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(-) (limited to 'bin/mw') 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 -- cgit v1.2.3 From 315069b5a27a7965dfa9efb5778ddaa6421e02eb Mon Sep 17 00:00:00 2001 From: Lokesh Mohanty Date: Sat, 2 Jul 2022 21:46:54 +0530 Subject: pass: add feature to optionally add a prefix --- bin/mw | 29 ++++++++++++++++------------- mw.1 | 2 ++ 2 files changed, 18 insertions(+), 13 deletions(-) (limited to 'bin/mw') 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 -- cgit v1.2.3 From 0b9135142a22dfc696628d620407e913cc58f778 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Mon, 4 Jul 2022 23:59:24 -0400 Subject: move msmtp cache and reorder prep --- bin/mw | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'bin/mw') 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 ;; -- cgit v1.2.3 From 36c87c512ed0e5b2fd3e67b79711eaab555de5e3 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Tue, 5 Jul 2022 17:37:36 -0400 Subject: removed introduced bug, fix #861 --- bin/mw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin/mw') 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\" -- cgit v1.2.3