diff options
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | README.md | 6 | ||||
-rwxr-xr-x | bin/mailsync | 9 | ||||
-rwxr-xr-x | bin/muttimage | 4 | ||||
-rwxr-xr-x | bin/mw | 23 | ||||
-rwxr-xr-x | bin/openfile | 2 | ||||
-rw-r--r-- | share/domains.csv | 23 | ||||
-rw-r--r-- | share/mailcap | 2 | ||||
-rw-r--r-- | share/mutt-wizard.muttrc | 10 |
9 files changed, 60 insertions, 20 deletions
@@ -32,5 +32,6 @@ uninstall: rm -f $(DESTDIR)$(PREFIX)/$$script; \ done rm -rf $(DESTDIR)$(PREFIX)/share/mutt-wizard + rm -f $(DESTDIR)$(MANPREFIX)/man1/mw.1 .PHONY: install uninstall @@ -52,7 +52,7 @@ There's a chance of errors if you use a slow-release distro like Ubuntu, Debian ### Optional -- `w3m` - view HTML email and images in neomutt. +- `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 syncthing mail with `mailsync` - `abook` - a terminal-based address book. Pressing tab while typing an address to send mail to will suggest contacts that are in your abook. @@ -110,9 +110,9 @@ mutt-wizard is free/libre software, licensed under the GPLv3. - 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: - -- For Gmail accounts, remember also to enable third-party ("""less secure""") applications before attempting installation. You might also need to manually "Enable IMAP" in the settings. +- 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. +- Protonmail bridge is prone to timing out. Watch out for this while adding an account. If the bridge times out, try again. - 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. diff --git a/bin/mailsync b/bin/mailsync index d79507d..f7c3211 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -2,12 +2,13 @@ # Sync mail and give notification if there is new mail. export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin -export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus +DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus +export DBUS_SESSION_BUS_ADDRESS export DISPLAY=:0.0 [ -d "$HOME/.local/share/password-store" ] && export PASSWORD_STORE_DIR="$HOME/.local/share/password-store" # Run only if user logged in (prevent cron errors) -pgrep -u "$USER" >/dev/null || { echo "$USER not logged in; sync will not run."; exit ;} +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 ;} @@ -47,7 +48,7 @@ else fi echo " 🔃" > /tmp/imapsyncicon_"$USER" -pkill -RTMIN+12 i3blocks >/dev/null 2>&1 +pkill -RTMIN+12 "${STATUSBAR:?}" >/dev/null 2>&1 # Parallelize multiple accounts for account in $accounts @@ -57,7 +58,7 @@ done wait rm -f /tmp/imapsyncicon_"$USER" -pkill -RTMIN+12 i3blocks >/dev/null 2>&1 +pkill -RTMIN+12 "${STATUSBAR:?}" >/dev/null 2>&1 notmuch new 2>/dev/null diff --git a/bin/muttimage b/bin/muttimage index c798293..a846bea 100755 --- a/bin/muttimage +++ b/bin/muttimage @@ -1,9 +1,9 @@ -#!/bin/bash +#!/usr/bin/env bash #get image resolution resolution=$(identify $1 | awk '{print $3}') IFS='x' # x is set as delimiter -read -ra ADDR <<< "$resolution" +read -ra ADDR <<< "$resolution" width=${ADDR[0]} height=${ADDR[1]} @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env 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" ] && @@ -69,6 +69,7 @@ Patterns * !\"[Gmail]/All Mail\" Create Both SyncState * MaxMessages $maxmes +ExpireUnread no # End profile " @@ -130,8 +131,22 @@ askinfo() { \ 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' && break;; + *) + 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 "^$domain" "$muttshare/domains.csv" 2>/dev/null)" + serverinfo="$(grep "^$search_query" "$muttshare/domains.csv" 2>/dev/null)" 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" @@ -190,7 +205,7 @@ EOF } protonfinger() { printf "Getting Protonmail bridge fingerprint...\\n" - fingerprint="$(msmtp --serverinfo --host=127.0.0.1 --port=1025 --tls --tls-certcheck=off)" || return 1 + 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 } @@ -224,7 +239,7 @@ finalize() { \ 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 =$title ===================== $(echo "$boxes" | sed -e "s/^\|$/\"/g" | tr "\n" " ")" >> "$accdir/$idnum-$title.muttrc" + echo "mailboxes $(echo "$boxes" | sed -e "s/^\|$/\"/g" | tr "\n" " ")" >> "$accdir/$idnum-$title.muttrc" 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 diff --git a/bin/openfile b/bin/openfile index e530b3e..b16483b 100755 --- a/bin/openfile +++ b/bin/openfile @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env 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" diff --git a/share/domains.csv b/share/domains.csv index 8c94237..11c95d2 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -1,4 +1,5 @@ ADDRESS,IMAP,imap port,SMTP,smtp port +icloud.com,imap.mail.me.com,993,smtp.mail.me.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 @@ -60,7 +61,7 @@ counsellor.com,imap.mail.com,993,smtp.mail.com,587 cryptolab.net,mail.autistici.org,993,smtp.autistici.org,465 cumallover.me,mail.cock.li,993,mail.cock.li,587 cyberservices.com,imap.mail.com,993,smtp.mail.com,587 -datentopf.org,mail.datentopf.org,993,mail.datentopf.org,587 +datentopf.org,imap.migadu.com,993,smtp.migadu.com,587 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 @@ -129,7 +130,7 @@ 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,imap-mail.outlook.com,993,smtp-mail.outlook.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 @@ -143,6 +144,7 @@ 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 +humbug.pw,imap.migadu.com,993,smtp.migadu.com,587 hushmail.com,imap.hushmail.com,993,smtp.hushmail.com,465 illinois.edu, imap.gmail.com,993,smtp.gmail.com,465 iname.com,imap.mail.com,993,smtp.mail.com,587 @@ -157,6 +159,7 @@ inventati.org,mail.autistici.org,993,smtp.autistici.org,465 itu.dk,imap-mail.outlook.com,993,smtp-mail.outlook.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 linuxmail.org,imap.mail.com,993,smtp.mail.com,587 live.com,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 @@ -165,9 +168,12 @@ 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.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 mailbox.org,imap.mailbox.org,993,smtp.mailbox.org,587 +mailbox.tu-dresden.de,msx.tu-dresden.de,993,msx.tu-dresden.de,587 +mailo.com,mail.mailo.com,993,mail.mailo.com,465 memeware.net,mail.cock.li,993,mail.cock.li,587 ml1.net,imap.fastmail.com,993,smtp.fastmail.com,465 mortemale.org,mail.autistici.org,993,smtp.autistici.org,465 @@ -194,6 +200,7 @@ 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.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 poczta.fm,poczta.interia.pl,993,poczta.interia.pl,465 @@ -208,30 +215,36 @@ protonmail.ch,127.0.0.1,1143,127.0.0.1,1025 protonmail.com,127.0.0.1,1143,127.0.0.1,1025 rape.lol,mail.cock.li,993,mail.cock.li,587 redchan.it,mail.cock.li,993,mail.cock.li,587 +resch.pw,imap.migadu.com,993,smtp.migadu.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 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 -stevens.edu,imap-mail.outlook.com,993,smpt-mail.outlook.com,587 +stevens.edu,imap.outlook.com,993,smtp.outlook.com,587 stronzi.org,mail.autistici.org,993,smtp.autistici.org,465 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.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 students.southwales.ac.uk,imap.gmail.com,993,smtp.gmail.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 techie.com,imap.mail.com,993,smtp.mail.com,587 +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 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 tu-harburg.de,mail.tu-harburg.de,993,mail.tu-harburg.de,587 tuhh.de,mail.tu-harburg.de,993,mail.tu-harburg.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 uni-duesseldorf.de,mail.hhu.de,993,mail.hhu.de,465 uoregon.edu,imap.uoregon.edu,993,smtp.uoregon.edu,587 @@ -250,6 +263,7 @@ wanadoo.fr,imap.orange.fr,993,smtp.orange.fr,465 wants.dicksinhisan.us,mail.cock.li,993,mail.cock.li,587 wants.dicksinmyan.us,mail.cock.li,993,mail.cock.li,587 web.de,imap.web.de,993,smtp.web.de,587 +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 @@ -263,3 +277,6 @@ 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 zoho.com,imap.zoho.com,993,smtp.zoho.com,465 +polito.it,mail.polito.it,993,mail.polito.it,465 +studio.unibo.it,outlook.office365.com,993,smtp.office365.com,587 +hs-mittweida.de,mail.hs-mittweida.de,993,mail.hs-mittweida.de,465 diff --git a/share/mailcap b/share/mailcap index a265aa4..9687b75 100644 --- a/share/mailcap +++ b/share/mailcap @@ -1,6 +1,6 @@ text/plain; $EDITOR %s ; text/html; openfile %s ; nametemplate=%s.html -text/html; w3m -I %{charset} -T text/html; copiousoutput; +text/html; lynx -assume_charset=%{charset} -display_charset=utf-8 -dump %s; nametemplate=%s.html; copiousoutput; image/*; muttimage %s ; copiousoutput video/*; setsid mpv --quiet %s &; copiousoutput application/pdf; openfile %s ; diff --git a/share/mutt-wizard.muttrc b/share/mutt-wizard.muttrc index 978341f..b74f244 100644 --- a/share/mutt-wizard.muttrc +++ b/share/mutt-wizard.muttrc @@ -44,6 +44,7 @@ bind index U undelete-message bind index L limit bind index h noop bind index l display-message +bind index <space> tag-entry #bind browser h goto-parent macro browser h '<change-dir><kill-line>..<enter>' "Go to parent folder" bind index,pager H view-raw-message @@ -60,9 +61,9 @@ bind pager \031 previous-line # Mouse wheel bind pager \005 next-line # Mouse wheel bind editor <Tab> complete-query -macro index,pager a "|abook --add-email\n" 'add sender to abook' +macro index,pager a "<enter-command>set my_pipe_decode=\$pipe_decode pipe_decode<return><pipe-message>abook --add-email<return><enter-command>set pipe_decode=\$my_pipe_decode; unset my_pipe_decode<return>" "add the sender address to abook" macro index \Cr "T~U<enter><tag-prefix><clear-flag>N<untag-pattern>.<enter>" "mark all messages as read" -macro index O "<shell-escape>mailsync -Va<enter>" "run offlineimap to sync all mail" +macro index O "<shell-escape>mailsync -Va<enter>" "run mbsync to sync all mail" macro index \Cf "<enter-command>unset wait_key<enter><shell-escape>read -p 'Enter a search term to find with notmuch: ' x; echo \$x >~/.cache/mutt_terms<enter><limit>~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' \`\"<enter>" "show only messages matching a notmuch pattern" macro index A "<limit>all\n" "show all messages (undo limit)" @@ -91,6 +92,11 @@ color index brightyellow black "~N" color index_author brightred black "~N" color index_subject brightcyan black "~N" +# Tagged mail is highlighted: +color index brightyellow blue "~T" +color index_author brightred blue "~T" +color index_subject brightcyan blue "~T" + # Other colors and aesthetic settings: mono bold bold mono underline underline |