diff options
-rw-r--r-- | FUNDING.yml | 3 | ||||
-rw-r--r-- | Makefile | 24 | ||||
-rw-r--r-- | README.md | 58 | ||||
-rwxr-xr-x | bin/mailsync | 43 | ||||
-rwxr-xr-x | bin/muttimage | 11 | ||||
-rwxr-xr-x | bin/mw | 442 | ||||
-rwxr-xr-x | bin/openfile | 3 | ||||
-rw-r--r-- | mw.1 | 81 | ||||
-rw-r--r-- | share/domains.csv | 133 | ||||
-rw-r--r-- | share/mailcap | 8 | ||||
-rw-r--r-- | share/mutt-wizard.muttrc | 34 |
11 files changed, 474 insertions, 366 deletions
diff --git a/FUNDING.yml b/FUNDING.yml new file mode 100644 index 0000000..f8e6076 --- /dev/null +++ b/FUNDING.yml @@ -0,0 +1,3 @@ +github: lukesmithxyz +custom: ["https://lukesmith.xyz/donate", "https://paypal.me/lukemsmith", "https://lukesmith.xyz/crypto"] +patreon: lukesmith @@ -1,12 +1,12 @@ .POSIX: OS = $(shell uname -s) -ifeq ($(OS), Darwin) +ifndef PREFIX PREFIX = /usr/local -else - PREFIX = /usr endif -MANPREFIX = $(PREFIX)/share/man +ifndef MANPREFIX + MANPREFIX = $(PREFIX)/share/man +endif install: mkdir -p $(DESTDIR)$(PREFIX)/bin @@ -15,20 +15,28 @@ install: chmod 755 $(DESTDIR)$(PREFIX)/$$script; \ done 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 - if [ "$(OS)" = "Darwin" ]; then \ - sed -iba 's/\/usr\//\/usr\/local\//' $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrc; \ - rm $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrcba; \ - fi mkdir -p $(DESTDIR)$(MANPREFIX)/man1 cp -f mw.1 $(DESTDIR)$(MANPREFIX)/man1/mw.1 + chmod 644 $(DESTDIR)$(MANPREFIX)/man1/mw.1 + if [ "$(PREFIX)" ]; then \ + sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrc; \ + rm -f $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrcba; \ + sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(PREFIX)/bin/mw; \ + rm -f $(DESTDIR)$(PREFIX)/bin/mwba; \ + sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(MANPREFIX)/man1/mw.1; \ + rm -f $(DESTDIR)$(MANPREFIX)/man1/mw.1ba; \ + fi uninstall: for script in bin/*; do \ rm -f $(DESTDIR)$(PREFIX)/bin/$$script; \ done rm -rf $(DESTDIR)$(PREFIX)/share/mutt-wizard + rm -f $(DESTDIR)$(MANPREFIX)/man1/mw.1 .PHONY: install uninstall @@ -3,16 +3,15 @@ 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 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 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 stores locally your password for easy remote access, accessible only by your GPG key +- 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,20 +25,34 @@ 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/). -*NOTE:* If you have used an older version of mutt-wizard, especially when it used to use `offlineimap`, you need to remove your old configs. Back anything up that's important and run: +The mutt-wizard is run with the command `mw`. Once everything is setup, you'll use `neomutt` to access your mail. -``` -rm -rf ~/.config/mutt ~/.msmtprc ~/.config/msmtp ~/.offlineimap ~/.offlineimaprc ~/.config/offlineimap ~/.mbsyncrc -``` +- `mw -a you@email.com` -- add a new email account +- `mw -l` -- list existing accounts +- `mw -y your@email.com` -- sync an email account +- `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 + +### Options usable when adding an account -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. +#### Providing arguments -- `mw add` -- add a new email account -- `mw ls` -- list existing accounts -- `mw pass` -- revise an account's password -- `mw delete` -- deleted an added account -- `mw purge` -- delete all accounts and settings -- `mw cron` -- toggle/configure a cronjob to sync mail +- `-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. +- `-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. +- `-o` -- Configure mutt for an account, but do not keep mail offline. ## Dependencies @@ -52,11 +65,9 @@ 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. -- `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` +- `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. -- 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. @@ -81,7 +92,7 @@ To give you an example of the interface, here's an idea: - `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 long used (le bloat) and the interface is simply text commands. +- `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. @@ -110,14 +121,13 @@ 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. -- Protonmail accounts will require you to set up "Protonmail Bridge" to access PM's IMAP and SMTP servers. Configure that before running mutt-wizard. +- 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. ## To-do -- Add ~~Mac OS~~/BSD compatibility (the script is confired to work for Mac OS now) +- 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) -- Option to keep configuration for accounts that failed to connect (maybe) diff --git a/bin/mailsync b/bin/mailsync deleted file mode 100755 index b038fe6..0000000 --- a/bin/mailsync +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env sh -# Sync mail and give notification if there is new mail. - -# Run only if user logged in (prevent cron errors) -pgrep -u "$USER" >/dev/null || exit - -# Checks for internet connection and set notification script. -ping -q -c 1 1.1.1.1 > /dev/null || 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." - -export DISPLAY=:0.0 - -# 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 ;} -else - notify() { notify-send "mutt-wizard" "📬 $2 new mail(s) in \`$1\` account." ;} -fi - -echo " 🔃" > /tmp/imapsyncicon_$USER -pkill -RTMIN+12 i3blocks >/dev/null 2>&1 - -# Run mbsync. You can feed this script different settings. -if [ $# -eq 0 ]; then - mbsync -a -else - mbsync "$@" -fi - -rm -f /tmp/imapsyncicon_$USER -pkill -RTMIN+12 i3blocks >/dev/null 2>&1 - -# Check all accounts/mailboxes for new mail. Notify if there is new content. -for account in "$HOME/.local/share/mail/"* -do - acc="$(echo "$account" | sed "s/.*\///")" - newcount=$(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 | wc -l) - [ "$newcount" -gt "0" ] && notify "$acc" "$newcount" & -done -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/muttimage b/bin/muttimage deleted file mode 100755 index c798293..0000000 --- a/bin/muttimage +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -#get image resolution -resolution=$(identify $1 | awk '{print $3}') -IFS='x' # x is set as delimiter -read -ra ADDR <<< "$resolution" -width=${ADDR[0]} -height=${ADDR[1]} - -### Display Image / offset with mutt bar -echo -e "2;3;\n0;1;0;42;$((width));$((height));0;0;0;0;$1\n4;\n3;" | /usr/lib/w3m/w3mimgdisplay & @@ -1,89 +1,91 @@ #!/bin/sh + command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2" -[ -r "$HOME/.password-store/.gpg-id" ] && - "$GPG" --list-secret-keys $(cat "$HOME/.password-store/.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 <yourgpgemail>\`.\\nIf you don't have a GPG public private key pair, run \`$GPG --full-gen-key\` first.\\n" +[ -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 <yourgpgemail>\`.\\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\` must be installed to run mutt-wizard.\\n" && exit - -case "$(uname)" in - Linux) prefix="/usr" ;; - *) prefix="/usr/local" ;; -esac -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 +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 muttshare="$prefix/share/mutt-wizard" -mbsyncrc="$HOME/.mbsyncrc" +mbsyncrc="${MBSYNCRC:-$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" -ssltype="IMAPS" # This is later changed to `None` later in the script if using Protonmail +msmtprc="${XDG_CONFIG_HOME:-$HOME/.config}/msmtp/config" +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" +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 ;} -getaccounts() { accounts="$(find "$accdir" -type f | grep -o "[0-9]-.*.muttrc" | sed "s/-/: /;s/\..*//" | 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" ;} 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 ~/.config/msmtp/msmtp.log +logfile $msmtplog " -msmtp_profile="account $title +msmtp_profile="account $fulladdr host $smtp -port $sport +port ${sport:-587} from $fulladdr user $login -passwordeval \"pass mutt-wizard-$title\" +passwordeval \"pass $pass_prefix$fulladdr\" +$tlsline " -mbsync_profile="IMAPStore $title-remote +mbsync_profile="IMAPStore $fulladdr-remote Host $imap -Port $iport +Port ${iport:-993} User $login -PassCmd \"pass mutt-wizard-$title\" -SSLType $ssltype +PassCmd \"pass $pass_prefix$fulladdr\" +AuthMechs LOGIN +SSLType ${ssltype:-IMAPS} CertificateFile $sslcert -MaildirStore $title-local +MaildirStore $fulladdr-local Subfolders Verbatim -Path ~/.local/share/mail/$title/ -Inbox ~/.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 [ "$accounttype" = "offline" ]; then +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 @@ -91,21 +93,21 @@ bind index,pager g noop bind index,pager M noop bind index,pager C noop bind index gg first-entry -macro index o \"<shell-escape>mailsync -V $title<enter>\" \"run mbsync to sync $title\" +macro index o \"<shell-escape>mw -y $fulladdr<enter>\" \"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 = \"$prefix/bin/msmtp -a $title\" +set sendmail = \"msmtp -a $fulladdr\" alias me $realname <$fulladdr> -set folder = \"imaps://$fulladdr@$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 -set imap_pass = \`pass mutt-wizard-$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 @@ -119,180 +121,144 @@ bind index gg first-entry unmailboxes * " 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 <<EOF +$serverinfo +EOF + imap="${imap:-$imapsugg}" + smtp="${smtp:-$smtpsugg}" + sport="${sport:-$sportsugg}" + 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 + pass rm -f "$pass_prefix$fulladdr" >/dev/null 2>&1 } 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 - 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/.*@//")" - 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)" - 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" + { [ -z "$imap" ] || [ -z "$smtp" ] ;} && parsedomains + [ -z "$imap" ] && echo "Give your email server's IMAP address (excluding the port number):" && 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" + [ -z "$smtp" ] && echo "Give your email server's SMTP address (excluding the port number):" && 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" + [ "$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}" + if [ -n "${password+x}" ]; then + createpass else - IFS=, read -r service imap iport smtp sport <<EOF -$serverinfo -EOF - printf "\\n\033[3;33mCongrats!\033[0m Server info has automatically been found, so you won't have to look anything up!\\n\t\033[1mIMAP server\033[0m: %s\\n\t\033[1mIMAP port\033[0m: %s\\n\t\033[1mSMTP server\033[0m: %s\\n\t\033[1mSMTP port\033[0m: %s\\nThis data will be used by the wizard.\\n" "$imap" "$iport" "$smtp" "$sport" - 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 fi - printf "Enter the \033[35mfull name\033[0m you want to be identified by on this account.\\n\tReal name: " - read -r realname - printf "Enter a short, \033[36mone-word identifier\033[0m for this email account that will distinguish them from any other accounts you add.\\n\tAccount name: " - read -r title - while ! echo "$title" | grep "$namere" >/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" - getpass - getprofiles - mkdir -p "$muttdir" "$accdir" "$cachedir/$title/bodies" "$HOME/.config/msmtp" - getaccounts - for x in $(seq 1 9); do echo "$accounts" | grep "$x" >/dev/null 2>&1 || { export idnum="$x"; break ;}; done +} + +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" + + # 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 + + # 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 - case "$service" in - protonmail.ch|protonmail.com|pm.me) protonfinger || return 1 ;; - esac - echo "$mutt_profile" > "$accdir/$idnum-$title.muttrc" + + # Create the mbsync config file. + mkdir -p "${mbsyncrc%/*}" 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 '<sync-mailbox><enter-command>source $accdir/$idnum-$title.muttrc<enter><change-folder>!<enter>;<check-stats>' \"switch to $fulladdr\" # mw-autogenerated" >> "$muttrc" -} -protonfinger() { printf "Getting Protonmail bridge fingerprint...\\n" - fingerprint="$(msmtp --serverinfo --tls --tls-certcheck=off -a "$title")" || return 1 - sed -ibu "s/account $title/&\ntls_trust_file\ntls_fingerprint $fingerprint/" "$msmtprc" ; rm -f "$msmtprc"bu + # 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 '<sync-mailbox><enter-command>source $accdir/$idnum-$fulladdr.muttrc<enter><change-folder>!<enter>;<check-stats>' \"switch to $fulladdr\" $MARKER" >> "$muttrc" + + notmuchauto # Create a notmuch config file if not present already. } -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$fulladdr" >/dev/null 2>&1 + pass insert "$pass_prefix$fulladdr" && break; done ;} -formatShortcut() { \ - while read -r data; do { echo "macro index,pager g$1 \"<change-folder>$data<enter>\" \"go to $2\" # mw-autogenerated" - echo "macro index,pager M$1 \"<save-message>$data<enter>\" \"move mail to $2\" # mw-autogenerated" - echo "macro index,pager C$1 \"<copy-message>$data<enter>\" \"copy mail to $2\" # mw-autogenerated"; } >> "$accdir/$idnum-$title.muttrc" - done ;} +formatShortcut() { toappend="$toappend +macro index,pager g$1 \"<change-folder>=$3<enter>\" \"go to $2\" $MARKER +macro index,pager M$1 \";<save-message>=$3<enter>\" \"move mail to $2\" $MARKER +macro index,pager C$1 \";<copy-message>=$3<enter>\" \"copy mail to $2\" $MARKER" >> "$accdir/$idnum-$fulladdr.muttrc" ;} -tryconnect() { mkdir -p "$maildir/$title" - 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/{}" +setBox() { toappend="$toappend +set $1 = \"+$2\" $MARKER" ;} + +getboxes() { [ -n "${force+x}" ] && mailboxes="INBOX +Drafts +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" 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() { \ - boxes="$(find "$maildir/$title/" -mindepth 1 -maxdepth 1 | sed "s/\ /\\\ /g;s/^.*\//=/")" - [ -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 =$title ===================== $(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 - 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 - [ "$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" +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]*) 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-$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" command -V urlview >/dev/null 2>&1 && [ ! -f "$HOME/.urlview" ] && echo "COMMAND \$BROWSER" > "$HOME/.urlview" - return 0 -} - -confirm() { printf "Do you want to %s? [y/N]\\n\t" "$@" && read -r input && ! echo "$input" | grep -i "^y$\|^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 "^y$\|^yes$" >/dev/null && 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" - list - read -r input - [ -z "$input" ] && return 1 - title="$(echo "$accounts" | grep "$input" | awk '{print $2}')" - [ -z "$title" ] && printf "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 - } - -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 * * * * export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus; export DISPLAY=:0; . \$HOME/.profile; $(type mailsync | cut -d' ' -f3)") | crontab - && - 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 - 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" "$HOME/.config/msmtp" "$cachedir" - echo "All configs and account settings have been purged." - sed -ibu "/\# mw-autogenerated/d" "$muttrc" ; rm -f "$muttrc"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 ;} notmuchauto() { \ [ -z "$NOTMUCH_CONFIG" ] && NOTMUCH_CONFIG="$HOME/.notmuch-config" @@ -304,7 +270,7 @@ name=$realname primary_email=$fulladdr [new] tags=unread;inbox; -ignore= +ignore=.mbsyncstate;.uidvalidity [search] exclude_tags=deleted;spam; [maildir] @@ -313,28 +279,80 @@ synchronize_flags=true gpg_path=$GPG" echo "$nmbasic" > "$NOTMUCH_CONFIG" ;} -trap 'echo -e "\033[0m\n"' INT +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 + else + action="$1" + fi; } -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 ;; - purge) purge ;; - cron) choosecron ;; +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 + 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" ;; + 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" + ssltype="None" + tlsline="tls_fingerprint $(msmtp --serverinfo --host=$smtp --port=$sport --tls --tls-certcheck=off | awk '/SHA256:/ {print $2}')" + setact add || exit 1 + ;; *) 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 - cron Enable or disable an autosync via cronjob - all else Print this message +Main actions: + -a your@email.com Add an email address + -l List email addresses configured + -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 + -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. 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\`. 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 && getprofiles && writeinfo && getboxes && finalize || { delete ; exit 1 ;} ;; + delete) delete $fulladdr ;; + sync) syncwrapper $fulladdr ;; esac diff --git a/bin/openfile b/bin/openfile index e530b3e..f6668dc 100755 --- a/bin/openfile +++ b/bin/openfile @@ -1,6 +1,7 @@ #!/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" +[ "$(uname)" = "Darwin" ] && opener="open" || opener="setsid xdg-open" mkdir -p "/tmp/$USER-mutt-tmp" file="/tmp/$USER-mutt-tmp/$(basename "$1")" rm -f "$file" @@ -3,10 +3,12 @@ mw \- mutt-wizard \- autoconfigure email accounts for neomutt and isync .SH SYNOPSIS .B mw -<command> +[ +.I OPTIONS +] .SH DESCRIPTION .B mw -takes a user email account and sets up a terminal-based email interface with it for +takes a user email account and sets up a terminal-based email interface for it with .B neomutt. This can include offline email with .B isync/mbsync @@ -16,22 +18,61 @@ 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 cron -toggle a cronjob that will automatically sync mail with -.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) +.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 +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,18 +93,16 @@ 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 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 -.I /usr/share/mutt-wizard/mutt-wizard.muttrc +.I /usr/local/share/mutt-wizard/mutt-wizard.muttrc and the default mailcap file can be found in .I -/usr/share/mutt-wizard/mailcap. +/usr/local/share/mutt-wizard/mailcap. Any of these settings can be overwritten in .I ~/.config/mutt/muttrc, but be mindful that your overriding binds should appear after the @@ -73,7 +112,7 @@ file is sourced. .TP .B Detecting server settings mutt-wizard has a repository of email services and their server information kept in -.I /usr/share/mutt-wizard/domains.csv +.I /usr/local/share/mutt-wizard/domains.csv which is used to automatically configure email settings. If your email provider is not found there, it will prompt you to input your email service's IMAP and SMTP server information which can usually be found by searching online. diff --git a/share/domains.csv b/share/domains.csv index 9ef1a27..c5c7e16 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -1,9 +1,12 @@ -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 +ad.unsw.edu.au,outlook.office365.com,993,smtp.office365.com,587 adexec.com,imap.mail.com,993,smtp.mail.com,587 airmail.cc,mail.cock.li,993,mail.cock.li,587 allergist.com,imap.mail.com,993,smtp.mail.com,587 @@ -13,37 +16,46 @@ 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 archaeologist.com,imap.mail.com,993,smtp.mail.com,587 arcticmail.com,imap.mail.com,993,smtp.mail.com,587 artlover.com,imap.mail.com,993,smtp.mail.com,587 asia.com,imap.mail.com,993,smtp.mail.com,587 -autograf.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465 auctioneer.net,imap.mail.com,993,smtp.mail.com,587 autistiche.org,mail.autistici.org,993,smtp.autistici.org,465 autistici.org,mail.autistici.org,993,smtp.autistici.org,465 +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 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 bjoernguthphotography.de,wp300.webpack.hosteurope.de,993,wp300.webpack.hosteurope.de,587 +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 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 +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 chemist.com,imap.mail.com,993,smtp.mail.com,587 chrissx.ga,chrissx.ga,993,chrissx.ga,25 +clarkson.edu,imap.gmail.com,993,smtp.gmail.com,587 +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 -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 @@ -68,76 +80,100 @@ disroot.org,disroot.org,993,disroot.org,587 distruzione.org,mail.autistici.org,993,smtp.autistici.org,465 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 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 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 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 +forpsi.com,imap.forpsi.com,993,smtp.forpsi.com,465 forthnet.gr,mail.forthnet.gr,993,smtp-auth.forthnet.gr,465 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 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.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.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 +hotmail.*,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 +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 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 insiberia.net,mail.autistici.org,993,smtp.autistici.org,465 insicuri.net,mail.autistici.org,993,smtp.autistici.org,465 -interia.eu,poczta.interia.pl,993,poczta.interia.pl,465 -interia.pl,poczta.interia.pl,993,poczta.interia.pl,465 interactio.io,imap.gmail.com,993,smtp.gmail.com,587 +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 +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 +kth.se,webmail.kth.se,993,smtp.kth.se,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 +live.de,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 +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 +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 +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,smtps.mailbox.org,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 +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 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 netcourrier.com,mail.netcourrier.com,993,mail.netcourrier.com,465 nigge.rs,mail.cock.li,993,mail.cock.li,587 +niser.ac.in,imap.gmail.com,993,smtp.gmail.com,587 nuke.africa,mail.cock.li,993,mail.cock.li,587 nyu.edu,imap.gmail.com,993,smtp.gmail.com,587 o2.pl,poczta.o2.pl,993,poczta.o2.pl,465 +odu.edu,imap.gmail.com,993,smtp.gmail.com,587 one.com,imap.one.com,993,send.one.com,465 onenetbeyond.org,mail.autistici.org,993,smtp.autistici.org,465 onet.com.pl,imap.poczta.onet.pl,993,smtp.poczta.onet.pl,465 @@ -147,71 +183,100 @@ 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.com,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 -outlook.de,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 -outlook.at,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 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 -mail.polimi.it,outlook.office365.com,993,smtp.office365.com,587 +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 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 +riseup.net,mail.riseup.net,993,mail.riseup.net,465 +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 +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 +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 +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 students.southwales.ac.uk,imap.gmail.com,993,smtp.gmail.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 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 +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 +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 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 +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 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 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,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 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 -yahoo.fr,imap.mail.yahoo.com,993,smtp.mail.yahoo.com,587 -yahoo.com,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 +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 diff --git a/share/mailcap b/share/mailcap index c9c0a68..b355f32 100644 --- a/share/mailcap +++ b/share/mailcap @@ -1,7 +1,9 @@ text/plain; $EDITOR %s ; -text/html; openfile %s ; -text/html; w3m -I %{charset} -T text/html; copiousoutput; -image/*; muttimage %s ; copiousoutput +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; diff --git a/share/mutt-wizard.muttrc b/share/mutt-wizard.muttrc index c8b7b59..94401e8 100644 --- a/share/mutt-wizard.muttrc +++ b/share/mutt-wizard.muttrc @@ -3,10 +3,9 @@ # 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/share/mutt-wizard/mailcap -set certificate_file = ~/.cache/mutt-wizard/certificates +set mailcap_path = /usr/local/share/mutt-wizard/mailcap set date_format="%y/%m/%d %I:%M%p" -set index_format="%2C %zs %?X?A& ? %D %-15.15F %s (%-4.4c)" +set index_format="%2C %Z %?X?A& ? %D %-15.15F %s (%-4.4c)" set sort = 'reverse-date' set smtp_authenticators = 'gssapi:login' set query_command = "abook --mutt-query '%s'" @@ -22,14 +21,18 @@ set forward_format = "Fwd: %s" # format of subject when forwarding set forward_quote # include message in forwards set reverse_name # reply as whomever it was to set include # include message in replies -auto_view text/html # automatically show html (mailcap uses w3m) +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. alternative_order text/plain text/enriched text/html bind index,pager i noop bind index,pager g noop bind index \Cf noop # General rebindings +bind index j next-entry +bind index k previous-entry bind attach <return> view-mailcap bind attach l view-mailcap bind editor <space> noop @@ -44,7 +47,10 @@ bind index U undelete-message bind index L limit bind index h noop bind index l display-message -bind browser h goto-parent +bind index,query <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 bind browser l select-entry bind pager,browser gg top-page bind pager,browser G bottom-page @@ -58,10 +64,15 @@ 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' +#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 "<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 \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=<>;chomp@a;s/\^id:// for@a;$,=\"|\";print@a'\`\"<enter>" "show only messages matching a notmuch pattern" +macro index O "<shell-escape>mw -Y<enter>" "run mw -Y to sync all mail" +macro index \Cf "<enter-command>unset wait_key<enter><shell-escape>printf 'Enter a search term to find with notmuch: '; read 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)" # Sidebar mappings @@ -70,7 +81,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 @@ -89,6 +100,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 |