From 96c0073ecfa9d8063404c23b48570287adf1544d Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 9 Jul 2020 17:50:01 -0400 Subject: mailsync and cron removed, mw sync added --- README.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 8681f8d..0da14f4 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,6 @@ Specifically, this wizard: - Encrypts and locally stores your password for easy remote access, accessible only by your GPG key - Handles as many as nine separate email accounts automatically - Auto-creates bindings to switch between accounts or between mailboxes -- Can automatically set mail updates as often as you want to sync your mail and update you when new mail arrives - Provides sensible defaults and an attractive appearance for the neomutt email client - If mutt-wizard doesn't know your server's IMAP/SMTP info by default, it will prompt you for them and will put them in all the right places. @@ -26,14 +25,14 @@ sudo make install User of Arch-based distros can also install mutt-wizard from the AUR as [mutt-wizard-git](https://aur.archlinux.org/packages/mutt-wizard-git/). -The mutt-wizard is run with the command `mw`. It also installs the `mailsync` command. Once everything is setup, you'll use `neomutt` to access your mail. +The mutt-wizard is run with the command `mw`. Once everything is setup, you'll use `neomutt` to access your mail. - `mw add` -- add a new email account - `mw ls` -- list existing accounts - `mw pass` -- revise an account's password - `mw delete` -- delete an added account +- `mw sync` -- sync all mail accounts and update notmuch database - `mw purge` -- delete all accounts and settings -- `mw cron` -- toggle/configure a cronjob to sync mail ## Dependencies @@ -47,10 +46,8 @@ There's a chance of errors if you use a slow-release distro like Ubuntu, Debian ### Optional - `lynx` - view HTML email in neomutt. -- `notmuch` - index and search mail. Install it and run `notmuch setup`, tell it that your mail is in `~/.local/share/mail/` (although `mw` will do this automatically if you haven't set notmuch up before). You can run it in mutt with `ctrl-f`. Run `notmuch new` to process new mail, although the included `mailsync` script does this for you. -- `libnotify`/`libnotify-bin` - allows notifications when syncing mail with `mailsync` +- `notmuch` - index and search mail. Install it and run `notmuch setup`, tell it that your mail is in `~/.local/share/mail/` (although `mw` will do this automatically if you haven't set notmuch up before). You can run it in mutt with `ctrl-f`. Run `notmuch new` to process new mail. - `abook` - a terminal-based address book. Pressing tab while typing an address to send mail to will suggest contacts that are in your abook. -- A cron manager - if you want to enable the auto-sync feature. - `pam-gnupg` - this is a more general program that I use. It automatically logs you into your GPG key on login so you will never need to input your password once logged on to your system. Check the repo and directions out [here](https://github.com/cruegge/pam-gnupg). - `urlview` - outputs urls in mail to browser. -- cgit v1.2.3 From 601d496fdf0df4d2f48877c545f0eee60632a9b2 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 9 Oct 2020 09:46:50 -0400 Subject: 3.0 release --- README.md | 31 +++++++-- bin/mw | 232 +++++++++++++++++++++++++++----------------------------------- mw.1 | 70 ++++++++++++++----- 3 files changed, 178 insertions(+), 155 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 0da14f4..0a7629f 100644 --- a/README.md +++ b/README.md @@ -27,12 +27,31 @@ User of Arch-based distros can also install mutt-wizard from the AUR as [mutt-wi The mutt-wizard is run with the command `mw`. Once everything is setup, you'll use `neomutt` to access your mail. -- `mw add` -- add a new email account -- `mw ls` -- list existing accounts -- `mw pass` -- revise an account's password -- `mw delete` -- delete an added account -- `mw sync` -- sync all mail accounts and update notmuch database -- `mw purge` -- delete all accounts and settings +- `mw -a you@email.com` -- add a new email account +- `mw -l` -- list existing accounts +- `mw -y your@email.com` -- sync an email account +- `my -Y` -- sync all configured email accounts +- `mw -d` -- choose an account to delete +- `mw -D your@email.com` -- delete account settings without confirmation +- `pass edit mw-your@email.com` -- revise an account's password + +### Options usable when adding an account + +#### Providing arguments + +- `-u` -- Give an account username if different from the email address. If you use my [emailwiz](https://github.com/lukesmithxyz/emailwiz), give your username with this option. Not necessary for other accounts. +- `-n` -- A real name to be used by the account. Put in quotations if multiple words +- `-i` -- IMAP server address +- `-I` -- IMAP server port (otherwise assumed to be 993) +- `-s` -- SMTP server address +- `-S` -- SMTP server port (otherwise assumed to be 587) +- `-m` -- Maximum number of emails to be kept offline. No maximum is default functionality. + +#### General Settings + +- `-p` -- Add a Protonmail account +- `-f` -- Assume mailbox names and force account configuration without connecting online at all. +- `-o` -- Configure mutt for an account, but do not keep mail offline. ## Dependencies diff --git a/bin/mw b/bin/mw index e23e5a1..387747a 100755 --- a/bin/mw +++ b/bin/mw @@ -1,20 +1,5 @@ #!/bin/sh -debug() { - echo "fulladdr: $fulladdr" - echo "login: $login" - echo "title: $title" - echo "imap: $imap" - echo "iport: $iport" - echo "smtp: $smtp" - echo "sport: $sport" - echo "proton: $proton" - echo "tls: $tls" - echo "force: $force" - echo "online: $online" - echo "action: $action" -} - command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2" [ -z ${PASSWORD_STORE_DIR+x} ] && PASSWORD_STORE_DIR="$HOME/.password-store" [ -r "$PASSWORD_STORE_DIR/.gpg-id" ] && @@ -22,7 +7,6 @@ command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2" printf "\`pass\` must be installed and initialized to encrypt passwords.\\nBe sure it is installed and run \`pass init \`.\\nIf you don't have a GPG public private key pair, run \`%s --full-gen-key\` first.\\n" "$GPG" exit } -! command -v mbsync >/dev/null && printf "\`mbsync (isync package)\` must be installed to run mutt-wizard.\\n" && exit prefix="/usr/local" pass_prefix="mw-" @@ -38,7 +22,6 @@ cachedir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard" muttrc="$muttdir/muttrc" msmtprc="${XDG_CONFIG_HOME:-$HOME/.config}/msmtp/config" msmtplog="${XDG_CONFIG_HOME:-$HOME/.config}/msmtp/msmtp.log" -ssltype="IMAPS" # This is later changed to `None` later in the script if using Protonmail MARKER="# mw-autogenerated" alias mbsync='mbsync -c "$mbsyncrc"' @@ -47,63 +30,63 @@ do [ -f "$x" ] && sslcert="$x" && break done || { echo "CA Certificate not found. Please install one or link it to /etc/ssl/certs/ca-certificates.crt" && exit 1 ;} -getaccounts() { accounts="$(find "$accdir" -type f | grep -o "[0-9]-.*.muttrc" | sed "s/-/: /;s/\..*//" | sort -n)" ;} +getaccounts() { accounts="$(find "$accdir" -type f | grep -o "[0-9]-.*.muttrc" | sed "s/-/: /;s/\.muttrc$//" | sort -n)" ;} + list() { getaccounts && [ -n "$accounts" ] && echo "$accounts" ;} getprofiles() { \ unset msmtp_header msmtp_profile mutt_profile mbsync_profile - printf "Creating profiles for \`%s\`..." "$title" msmtp_header="defaults auth on tls on tls_trust_file $sslcert logfile $msmtplog " -msmtp_profile="account $title +msmtp_profile="account $fulladdr host $smtp port ${sport:-587} from $fulladdr user $login -passwordeval \"pass $pass_prefix$title\" +passwordeval \"pass $pass_prefix$fulladdr\" $starttlsoff " -mbsync_profile="IMAPStore $title-remote +mbsync_profile="IMAPStore $fulladdr-remote Host $imap Port ${iport:-993} User $login -PassCmd \"pass $pass_prefix$title\" +PassCmd \"pass $pass_prefix$fulladdr\" AuthMechs LOGIN -SSLType $ssltype +SSLType ${ssltype:-IMAPS} CertificateFile $sslcert -MaildirStore $title-local +MaildirStore $fulladdr-local Subfolders Verbatim -Path ${XDG_DATA_HOME:-$HOME/.local/share}/mail/$title/ -Inbox ${XDG_DATA_HOME:-$HOME/.local/share}/mail/$title/INBOX +Path ${XDG_DATA_HOME:-$HOME/.local/share}/mail/$fulladdr/ +Inbox ${XDG_DATA_HOME:-$HOME/.local/share}/mail/$fulladdr/INBOX Flatten . -Channel $title +Channel $fulladdr Expunge Both -Master :$title-remote: -Slave :$title-local: +Master :$fulladdr-remote: +Slave :$fulladdr-local: Patterns * !\"[Gmail]/All Mail\" Create Both SyncState * -MaxMessages $maxmes +MaxMessages ${maxmes:-0} ExpireUnread no # End profile " if [ -z "${online+x}" ]; then mutt_profile="# vim: filetype=neomuttrc -# muttrc file for account $title +# muttrc file for account $fulladdr set realname = \"$realname\" set from = \"$fulladdr\" -set sendmail = \"msmtp -a $title\" +set sendmail = \"msmtp -a $fulladdr\" alias me $realname <$fulladdr> -set folder = \"$maildir/$title\" -set header_cache = $cachedir/$title/headers -set message_cachedir = $cachedir/$title/bodies +set folder = \"$maildir/$fulladdr\" +set header_cache = $cachedir/$fulladdr/headers +set message_cachedir = $cachedir/$fulladdr/bodies set mbox_type = Maildir bind index,pager gg noop @@ -111,21 +94,21 @@ bind index,pager g noop bind index,pager M noop bind index,pager C noop bind index gg first-entry -macro index o \"mbsync -V $title\" \"run mbsync to sync $title\" +macro index o \"mbsync -V $fulladdr\" \"run mbsync to sync $fulladdr\" unmailboxes * " else mutt_profile="# vim: filetype=neomuttrc -# muttrc file for account $title +# muttrc file for account $fulladdr set realname = \"$realname\" set from = \"$fulladdr\" -set sendmail = \"msmtp -a $title\" +set sendmail = \"msmtp -a $fulladdr\" alias me $realname <$fulladdr> set folder = \"imaps://$login@$imap:${iport:-993}\" set imap_user = \"$login\" -set header_cache = $cachedir/$title/headers -set message_cachedir = $cachedir/$title/bodies -set imap_pass = \"\`pass $pass_prefix$title\`\" +set header_cache = $cachedir/$fulladdr/headers +set message_cachedir = $cachedir/$fulladdr/bodies +set imap_pass = \"\`pass $pass_prefix$fulladdr\`\" set mbox_type = Maildir set ssl_starttls = yes @@ -142,7 +125,10 @@ fi printf "DONE.\\n" } -parsedomains(){ serverinfo="$(grep "^${fulladdr#*@}" "$muttshare/domains.csv" 2>/dev/null)" +parsedomains(){ \ + # Parses the domains.csv file for server information and sets + # the required variables unless overridden by the user. + serverinfo="$(grep "^${fulladdr#*@}" "$muttshare/domains.csv" 2>/dev/null)" [ -z "$serverinfo" ] && serverinfo="$(grep "$(echo "${fulladdr#*@}" | sed "s/\.[^\.]*$/\.\\\*/")" "$muttshare/domains.csv" 2>/dev/null)" @@ -156,39 +142,42 @@ EOF iport="${iport:-$iportsugg}" } +delete() { if [ -z "${fulladdr+x}" ]; then + echo "Select the account your would like to delete (by number):" + list + read -r input + match="^$input:" + else + match=" $fulladdr$" + getaccounts + fi + + fulladdr="$(echo "$accounts" | grep "$match" | cut -f2 -d' ')" + + [ -z "$fulladdr" ] && echo "Invalid account name given." && return 1 + + sed -ibu "/IMAPStore $fulladdr-remote$/,/# End profile/d" "$mbsyncrc" ; rm -rf "$mbsyncrc"bu + rm -rf "${cachedir:?}/${fulladdr:?}" "$accdir/"[1-9]"-$fulladdr.muttrc" + sed -ibu "/[0-9]-$fulladdr.muttrc/d" "$muttrc" ; rm -f "$muttrc"bu + sed -ibu "/account $fulladdr/,/^\(\s*$\|account\)/d" "$msmtprc"; rm -f "$msmtprc"bu + } + askinfo() { \ [ -z "$fulladdr" ] && echo "Give the full email address to add:" && read -r fulladdr - while ! echo "$fulladdr" | grep -qE "$emailre"; do echo "\`$fulladdr\` is not a valid email address. Please retype the address:" read -r fulladdr done - - # If we don't have either the IMAP or SMTP servers, look for them and ports. { [ -z "$imap" ] || [ -z "$smtp" ] ;} && parsedomains + [ -z "$imap" ] && echo "Give your email server's IMAP address (excluding the port number):" && + read -r imap + [ -z "$smtp" ] && echo "Give your email server's SMTP address (excluding the port number):" && + read -r smtp [ "$sport" = 465 ] && starttlsoff="tls_starttls off" - [ -z "$realname" ] && echo "Give the name you would like to be identified by on the email account:" && read -r realname - - title="$fulladdr" - #while ! echo "$title" | grep -q "$namere" || ls "$accdir"/[0-9]"-$title.muttrc" >/dev/null 2>&1; do - #printf "\033[31mTry again\033[0m. Pick a nickname that is one word only including lowercase letters and _ or - and that you have \033[1mnot\033[0m used before.\\n\tAccount name: \033[36m\t" - #read -r title - #printf "\033[0m" - #done - - [ -z "$login" ] && echo "Give the account log-on/username for this address:" && read -r login login="${login:-$fulladdr}" - - - - #case "$service" in - #gmail.com) printf "\033[31mREMEMBER: Gmail users must enable \"less secure\" (third-party) applications first for the sync to work:\\nhttps://support.google.com/accounts/answer/6010255\\n\033[0m" ;; - #protonmail.ch|protonmail.com|pm.me) printf "\033[31mREMEMBER: Protonmail users must install and configure Protonmail Bridge first for the sync to work:\\nhttps://protonmail.com/bridge/\\n\033[0m" && ssltype="None" ;; - #esac - getpass } @@ -198,7 +187,7 @@ writeinfo() { getprofiles # Create required directories. - mkdir -p "$muttdir" "$accdir" "$cachedir/$title/bodies" "${XDG_CONFIG_HOME:-$HOME/.config}/msmtp" "$maildir/$title" + mkdir -p "$muttdir" "$accdir" "$cachedir/$fulladdr/bodies" "${XDG_CONFIG_HOME:-$HOME/.config}/msmtp" "$maildir/$fulladdr" # Get accounts and find the first missing account number (max. 9). getaccounts @@ -214,7 +203,7 @@ writeinfo() { command -V apt-get >/dev/null 2>&1 && ln -s "$msmtprc" "$HOME/.msmtprc" 2>/dev/null # Create the individual mutt config file for the account. - echo "$mutt_profile" > "$accdir/$idnum-$title.muttrc" + echo "$mutt_profile" > "$accdir/$idnum-$fulladdr.muttrc" # Create the mbsync config file. mkdir -p "${mbsyncrc%/*}" @@ -227,26 +216,21 @@ writeinfo() { # and add the shortcuts to the account. [ ! -f "$muttrc" ] && echo "# vim: filetype=neomuttrc" > "$muttrc" && echo "muttrc created." ! grep -q "^source.*mutt-wizard.muttrc" "$muttrc" && echo "source $mwconfig $MARKER" >> "$muttrc" - ! grep "^source.*.muttrc" "$muttrc" | grep -qv "$mwconfig" && echo "source $accdir/$idnum-$title.muttrc $MARKER" >> "$muttrc" - echo "macro index,pager i$idnum 'source $accdir/$idnum-$title.muttrc!;' \"switch to $fulladdr\" $MARKER" >> "$muttrc" - + ! grep "^source.*.muttrc" "$muttrc" | grep -qv "$mwconfig" && echo "source $accdir/$idnum-$fulladdr.muttrc $MARKER" >> "$muttrc" + echo "macro index,pager i$idnum 'source $accdir/$idnum-$fulladdr.muttrc!;' \"switch to $fulladdr\" $MARKER" >> "$muttrc" } protonfinger() { printf "Getting Protonmail bridge fingerprint...\\n" - fingerprint="$(msmtp --serverinfo --host=127.0.0.1 --port=1025 --tls --tls-certcheck=off | grep SHA256: | sed 's/^.*: //')" - sed -ibu "s/account $title/&\ntls_trust_file\ntls_fingerprint $fingerprint/" "$msmtprc" ; rm -f "$msmtprc"bu -} + fingerprint="$(msmtp --serverinfo --host=$smtp --port=$sport --tls --tls-certcheck=off | grep SHA256: | sed 's/^.*: //')" + sed -ibu "s/account $fulladdr/&\ntls_trust_file\ntls_fingerprint $fingerprint/" "$msmtprc" ; rm -f "$msmtprc"bu ;} -getpass() { while : ; do pass rm -f "$pass_prefix$title" >/dev/null 2>&1 - pass insert "$pass_prefix$title" && break; done ;} +getpass() { while : ; do pass rm -f "$pass_prefix$fulladdr" >/dev/null 2>&1 + pass insert "$pass_prefix$fulladdr" && break; done ;} formatShortcut() { toappend="$toappend macro index,pager g$1 \"=$3\" \"go to $2\" $MARKER - getpass macro index,pager M$1 \";=$3\" \"move mail to $2\" $MARKER - getpass -macro index,pager C$1 \";=$3\" \"copy mail to $2\" $MARKER" >> "$accdir/$idnum-$title.muttrc" -} +macro index,pager C$1 \";=$3\" \"copy mail to $2\" $MARKER" >> "$accdir/$idnum-$fulladdr.muttrc" ;} setBox() { toappend="$toappend set $1 = \"+$2\" $MARKER" ;} @@ -254,73 +238,54 @@ set $1 = \"+$2\" $MARKER" ;} getboxes() { [ -n "${force+x}" ] && mailboxes="INBOX Drafts Junk +Trash Sent Archive" && return 0 - if mailboxes="$(mbsync -l "$title" | sed 's/\//./')" >/dev/null 2>&1 && [ -n "$mailboxes" ]; then - [ "$accounttype" = "online" ] && sed -ibu "/IMAPStore $title-remote$/,/# End profile/d" "$mbsyncrc" ; rm -f "$mbsyncrc"bu - printf "\033[32mMailboxes detected.\033[0m\\n" + if mailboxes="$(mbsync -l "$fulladdr" | sed 's/\//./')" >/dev/null 2>&1 && [ -n "$mailboxes" ]; then + [ "$accounttype" = "online" ] && sed -ibu "/IMAPStore $fulladdr-remote$/,/# End profile/d" "$mbsyncrc" ; rm -f "$mbsyncrc"bu return 0 else + echo "$mailboxes" printf "\033[31m\033[31mLog-on not successful.\033[0m\\nIt seems that either you inputted the wrong password or server settings, or there are other requirements for your account out of the control of mutt-wizard.\\n" return 1 fi ;} -finalize() { \ - - # Create the required mailbox structure. - echo "$mailboxes" | xargs -I {} mkdir -p "$maildir/$title/{}" - - printf "Setting default mailboxes for your Inbox, Sent, Drafts and Trash in mutt...\\n" - - sed -ibu "/$MARKER/d" "$accdir/$idnum-$title.muttrc" ; rm -f "$accdir/$idnum-$title.muttrcbu" - +finalize() { echo "$mailboxes" | xargs -I {} mkdir -p "$maildir/$fulladdr/{}/cur" "$maildir/$fulladdr/{}/tmp" "$maildir/$fulladdr/{}/new" + sed -ibu "/$MARKER/d" "$accdir/$idnum-$fulladdr.muttrc" ; rm -f "$accdir/$idnum-$fulladdr.muttrcbu" toappend="mailboxes $(echo "$mailboxes" | sed "s/^/\"=/;s/$/\"/" | paste -sd ' ' )" - for x in $mailboxes; do case $x in *[Ii][Nn][Bb][Oo][Xx]*) formatShortcut i inbox "$x"; setBox spoolfile "$x" ;; *[Ss][Ee][Nn][Tt]*) setBox record "$x"; formatShortcut s sent "$x" ;; *[Dd][Rr][Aa][Ff][Tt][Ss]*) setBox postponed "$x"; formatShortcut d drafts "$x" ;; - *[Tt][Rr][Aa][Ss][Hh]*|*[Jj][Uu][Nn][Kk]*) formatShortcut t trash "$x"; setBox trash "$x" ;; + *[Tt][Rr][Aa][Ss][Hh]*) formatShortcut t trash "$x"; setBox trash "$x" ;; + *[Jj][Uu][Nn][Kk]*) formatShortcut j junk "$x" ;; *[Aa][Rr][Cc][Hh][Ii][Vv][Ee]*) formatShortcut a archive "$x" ;; *[Ss][Pp][Aa][Mm]*) formatShortcut S spam "$x" ;; esac done - - echo "$toappend" >> "$accdir/$idnum-$title.muttrc" - - [ -z "${online+x}" ] && printf "All done.\\n\033[33mYou should now be able to run \`\033[32mmbsync %s\033[33m\` to begin to download your mail.\033[0m\\n" "$title" - - # Create a urlview config file if non-existent. + echo "$toappend" >> "$accdir/$idnum-$fulladdr.muttrc" + [ -z "${online+x}" ] && printf "\033[33mYou should now be able to run \`\033[32mw -y %s\033[33m\` to begin to download your mail.\033[0m\\n" "$fulladdr" command -V urlview >/dev/null 2>&1 && [ ! -f "$HOME/.urlview" ] && echo "COMMAND \$BROWSER" > "$HOME/.urlview" - - return 0 -} + return 0 ;} confirm() { printf "Do you want to %s? [yes/N]\\n\t" "$@" && read -r input && ! echo "$input" | grep -qi "^yes$" && printf "That doesn't seem like a yes to me.\\n\\n" && return 1 printf "Are you really, really sure you want to %s?\\n\t" "$@" && read -r input && ! echo "$input" | grep -qi "^yes$" && printf "That doesn't seem like a yes to me.\\n\\n" && return 1 return 0 ;} -pick() { printf "Select an accounts to %s:\\n" "$1" +pick() { [ -n "${fulladdr+x}" ] && return 0 + echo "Select the account your would like to $1 (by number):" list read -r input - [ -z "$input" ] && return 1 - title="$(echo "$accounts" | grep "$input" | awk '{print $2}')" - [ -z "$title" ] && printf "Invalid response." && return 1 + fulladdr="$(echo "$accounts" | grep "^$input:" | cut -f2 -d' ')" + [ -z "$fulladdr" ] && echo "Invalid response." && return 1 return 0 ;} -delete() { sed -ibu "/IMAPStore $title-remote$/,/# End profile/d" "$mbsyncrc" ; rm -rf "$mbsyncrc"bu - rm -rf "${cachedir:?}/${title:?}" "$accdir/"[1-9]"-$title.muttrc" - sed -ibu "/[0-9]-$title.muttrc/d" "$muttrc" ; rm -f "$muttrc"bu - sed -ibu "/account $title/,/^\(\s*$\|account\)/d" "$msmtprc"; rm -f "$msmtprc"bu - } - syncwrapper() { mbsync "${1:--a}" & ( kill -46 "$(pidof "${STATUSBAR:-dwmblocks}")" >/dev/null 2>&1 ) 2>/dev/null wait ( kill -46 "$(pidof "${STATUSBAR:-dwmblocks}")" >/dev/null 2>&1 ) 2>/dev/null - notmuch new -} + notmuch new ;} purge() { confirm "delete all account data" || exit rm -rf "$mbsyncrc" "$accdir" "${XDG_CONFIG_HOME:-$HOME/.config}/msmtp" "$cachedir" @@ -357,48 +322,47 @@ setaction() { if [ -n "${action+x}" ] && [ "$action" != "$1" ]; then action="$1" fi; } -while getopts "gbpPlhdYD:y:i:I:s:S:u:a:" o; do case "${o}" in +while getopts "fplhdYD:y:i:I:s:S:u:a:n:" o; do case "${o}" in l) setaction list || exit 1 ;; - p) setaction pass || exit 1 ;; d) setaction delete || exit 1 ;; - D) setaction delete || exit 1 ; title="$OPTARG" ;; - y) setaction sync || exit 1 ; title="$OPTARG" ;; + D) setaction delete || exit 1 ; fulladdr="$OPTARG" ;; + y) setaction sync || exit 1 ; fulladdr="$OPTARG" ;; Y) setaction sync || exit 1 ;; - a) setaction add || exit 1 ; fulladdr="$OPTARG" ;; i) setaction add || exit 1 ; imap="$OPTARG" ;; I) setaction add || exit 1 ; iport="$OPTARG" ;; s) setaction add || exit 1 ; smtp="$OPTARG" ;; S) setaction add || exit 1 ; sport="$OPTARG" ;; u) setaction add || exit 1 ; login="$OPTARG" ;; - + n) setaction add || exit 1 ; realname="$OPTARG" ;; + m) setaction add || exit 1 ; maxmes="$OPTARG" ;; o) setaction add || exit 1 ; online=True ;; - b) setaction add || exit 1 ; force=True ;; - P) echo "NOTE: Protonmail users must install and configure Protonmail Bridge first for the first sync to work." + f) setaction add || exit 1 ; force=True ;; + p) echo "NOTE: Protonmail users must install and configure Protonmail Bridge first for the first sync to work." proton=True imap="127.0.0.1" - iport=1143 + iport="1143" smtp="127.0.0.1" - sport=1025 + sport="1025" + ssltype="None" + protonfinger setaction add || exit 1 ;; - - g) debug ;; - *) cat << EOF mw: mutt-wizard, auto-configure email accounts for mutt including downloadable mail with \`isync\`. Main actions: -a your@email.com Add an email address - -d Remove an already added address - -D nameofaccount Force remove account without confirmation -l List email addresses configured - -y nameofaccount Sync mail for account by name + -d Remove an already added address + -D your@email.com Force remove account without confirmation + -y your@email.com Sync mail for account by name -Y Sync mail for all accounts Options allowed with -a: -u Account login name if not full address. + -n "Real name" to be on the email account. -i IMAP server address -I IMAP server port -s SMTP server address @@ -409,15 +373,19 @@ Options allowed with -a: NOTE: Once at least one account is added, you can run \`mbsync -a\` to begin downloading mail. + +To chane an account's password, run \`pass edit ${pass_prefix}your@email.com\`. EOF +exit 1 ;; esac done +! command -v mbsync >/dev/null && [ -z "${force+x}" ] && printf "\`mbsync (isync package)\` must be installed to run mutt-wizard.\\n" && exit + case "$action" in list) list ;; add) askinfo && writeinfo && getboxes && finalize || delete ;; - pass) pick "change the password of" && getpass ;; - delete) pick delete && confirm "delete the \`$title\` profile" && delete ;; - sync) syncwrapper $title ;; + delete) delete $fulladdr ;; + sync) syncwrapper $fulladdr ;; purge) purge ;; esac diff --git a/mw.1 b/mw.1 index 55ad43c..eb344b3 100644 --- a/mw.1 +++ b/mw.1 @@ -3,7 +3,9 @@ mw \- mutt-wizard \- autoconfigure email accounts for neomutt and isync .SH SYNOPSIS .B mw - +[ +.I OPTIONS +] .SH DESCRIPTION .B mw takes a user email account and sets up a terminal-based email interface for it with @@ -16,22 +18,58 @@ for sending mail, and also passwords automatically encrypted and stored with .B pass. .SH COMMANDS .TP -.B add -configure an email account +.B -a your@email.com +add an email address .TP -.B ls +.B -l list all email accounts configured by mutt-wizard .TP -.B delete -delete the configuration files for an already configured email account +.B -d +pick an already configured account and remove its configuration .TP -.B purge -totally purge all local mutt-wizard accounts +.B -D your@email.com +remove a configured account without confirmation .TP -.B sync -sync mail accounts then update notmuch database -.B mailsync -as often as you wish +.B -y your@email.com +download and upload mail for an email account +.TP +.B -Y +sync all email accounts +.SH OPTIONS FOR ADDING ACCOUNTS +These can be specified on the command line, otherwise, you will be prompted for what is necessary. mutt-wizard knows the IMAP/SMTP server information for most email providers, so specifying them is usually redundant. +.TP +.B -u billy +Account logon/username if required and different from email address. +.TP +.B -n Billy +Real name which will appear in emails. Should be put in quotes if multiple words. +.TP +.B -m number +Set a maximum number of messages to be stored offline. +.TP +.B -i +IMAP server address +.TP +.B -I +IMAP server port (assumed to be 993 if not specified) +.TP +.B -s +SMTP server address +.TP +.B -S +SMTP server port (assumed to be 587 if not specified) +.SH OTHER OPTIONS +.TP +.B -f +Force account creation and guess mailboxes without attempting to connect to server. Otherwise if connection cannot be made, the configured account settings will not be persistent. +.TP +.B -o +Create settings for an account to be used online only without mail syncing abilities. Without +.B -f +connection will still be attempted in setup to discover mailboxes. +.TP +.B -p +Add a Protonmail account. Protonmail Bridge must be installed and set up. .SH DETAILS .TP .B Mail location @@ -52,11 +90,9 @@ and can be edited by the user if needbe. Note that the mutt-wizard will also sou file. .TP .B Mail deletion -Neither -.B delete -or -.B purge -will delete downloaded mail for safety (and time)'s sake. If you want to delete downloaded mail, do so manually by removing it from the directory above. +mutt-wizard's delete action will delete configuration files and +.I not +downloaded mail for safety (and time)'s sake. If you want to delete downloaded mail, do so manually by removing it from the directory above. .TP .B Default settings The mutt-wizard has many default settings that focus on making it aesthetically pleasing and supplying more vim-like bindings. These can be found in -- cgit v1.2.3 From 4c268e53c7dd7b023222cf18d042268d70b6c028 Mon Sep 17 00:00:00 2001 From: Gergely Peidl Date: Mon, 12 Oct 2020 18:58:04 +0200 Subject: Fix typo. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index 0a7629f..25c0e7e 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ The mutt-wizard is run with the command `mw`. Once everything is setup, you'll u - `mw -a you@email.com` -- add a new email account - `mw -l` -- list existing accounts - `mw -y your@email.com` -- sync an email account -- `my -Y` -- sync all configured email accounts +- `mw -Y` -- sync all configured email accounts - `mw -d` -- choose an account to delete - `mw -D your@email.com` -- delete account settings without confirmation - `pass edit mw-your@email.com` -- revise an account's password -- cgit v1.2.3 From ca6cbd54b82ceb0d7b4c0987dff2c2b3b30b15fe Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Mon, 12 Oct 2020 18:50:10 -0400 Subject: passwords can be given by commandline --- README.md | 1 + bin/mw | 14 +++++++++++--- mw.1 | 3 +++ 3 files changed, 15 insertions(+), 3 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 0a7629f..10bdc1f 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ The mutt-wizard is run with the command `mw`. Once everything is setup, you'll u - `-s` -- SMTP server address - `-S` -- SMTP server port (otherwise assumed to be 587) - `-m` -- Maximum number of emails to be kept offline. No maximum is default functionality. +- `-x` -- Account password. You will be prompted for it otherwise. #### General Settings diff --git a/bin/mw b/bin/mw index 4a9970d..eeebe53 100755 --- a/bin/mw +++ b/bin/mw @@ -122,7 +122,6 @@ bind index gg first-entry unmailboxes * " fi - printf "DONE.\\n" } parsedomains(){ serverinfo="$(grep "^${fulladdr#*@}" "$muttshare/domains.csv" 2>/dev/null)" @@ -156,6 +155,7 @@ delete() { if [ -z "${fulladdr+x}" ]; then rm -rf "${cachedir:?}/${fulladdr:?}" "$accdir/"[1-9]"-$fulladdr.muttrc" sed -ibu "/[0-9]-$fulladdr.muttrc/d" "$muttrc" ; rm -f "$muttrc"bu sed -ibu "/account $fulladdr/,/^\(\s*$\|account\)/d" "$msmtprc"; rm -f "$msmtprc"bu + pass rm -f "$pass_prefix$fulladdr" >/dev/null 2>&1 } askinfo() { \ @@ -174,9 +174,16 @@ askinfo() { \ [ -z "$realname" ] && echo "Give the name you would like to be identified by on the email account:" && read -r realname login="${login:-$fulladdr}" - getpass + if [ -n "${password+x}" ]; then + createpass + else + getpass + fi } +createpass() { echo "$password" > "$PASSWORD_STORE_DIR/$pass_prefix$fulladdr" + "$GPG" -qer "$(cat "$PASSWORD_STORE_DIR/.gpg-id")" "$PASSWORD_STORE_DIR/$pass_prefix$fulladdr" + rm -f "$PASSWORD_STORE_DIR/$pass_prefix$fulladdr" ;} writeinfo() { mkdir -p "$muttdir" "$accdir" "$cachedir/$fulladdr/bodies" "${XDG_CONFIG_HOME:-$HOME/.config}/msmtp" "$maildir/$fulladdr" @@ -287,7 +294,7 @@ setact() { if [ -n "${action+x}" ] && [ "$action" != "$1" ]; then trap 'echo -e "\033[0m\n"; exit' INT ABRT -while getopts "fplhdYD:y:i:I:s:S:u:a:n:" o; do case "${o}" in +while getopts "fplhdYD:y:i:I:s:S:u:a:n:x:" o; do case "${o}" in l) setact list || exit 1 ;; d) setact delete || exit 1 ;; D) setact delete || exit 1 ; fulladdr="$OPTARG" ;; @@ -303,6 +310,7 @@ while getopts "fplhdYD:y:i:I:s:S:u:a:n:" o; do case "${o}" in m) setact add || exit 1 ; maxmes="$OPTARG" ;; o) setact add || exit 1 ; online=True ;; f) setact add || exit 1 ; force=True ;; + x) setact add || exit 1 ; password="$OPTARG" ;; p) echo "NOTE: Protonmail users must install and configure Protonmail Bridge first for the first sync to work." proton=True imap="127.0.0.1" diff --git a/mw.1 b/mw.1 index eb344b3..3ed4d95 100644 --- a/mw.1 +++ b/mw.1 @@ -58,6 +58,9 @@ SMTP server address .TP .B -S SMTP server port (assumed to be 587 if not specified) +.TP +.B -x +Account password. You will be prompted for the password interactively if this option is not given. .SH OTHER OPTIONS .TP .B -f -- cgit v1.2.3 From 50c197ac632a35f3d8d012596f872a7854475030 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 19 Nov 2020 09:20:37 -0500 Subject: attachment fix; documentation fixes --- README.md | 6 ++++-- bin/mw | 2 +- bin/openfile | 13 +++++++------ share/mutt-wizard.muttrc | 1 + 4 files changed, 13 insertions(+), 9 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 1027555..31118f1 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ The mutt-wizard is run with the command `mw`. Once everything is setup, you'll u #### Providing arguments -- `-u` -- Give an account username if different from the email address. If you use my [emailwiz](https://github.com/lukesmithxyz/emailwiz), give your username with this option. Not necessary for other accounts. +- `-u` -- Give an account username if different from the email address. - `-n` -- A real name to be used by the account. Put in quotations if multiple words - `-i` -- IMAP server address - `-I` -- IMAP server port (otherwise assumed to be 993) @@ -65,10 +65,10 @@ There's a chance of errors if you use a slow-release distro like Ubuntu, Debian ### Optional +- `pam-gnupg` - Automatically logs you into your GPG key on login so you will never need to input your password once logged on to your system. Check the repo and directions out [here](https://github.com/cruegge/pam-gnupg). - `lynx` - view HTML email in neomutt. - `notmuch` - index and search mail. Install it and run `notmuch setup`, tell it that your mail is in `~/.local/share/mail/` (although `mw` will do this automatically if you haven't set notmuch up before). You can run it in mutt with `ctrl-f`. Run `notmuch new` to process new mail. - `abook` - a terminal-based address book. Pressing tab while typing an address to send mail to will suggest contacts that are in your abook. -- `pam-gnupg` - this is a more general program that I use. It automatically logs you into your GPG key on login so you will never need to input your password once logged on to your system. Check the repo and directions out [here](https://github.com/cruegge/pam-gnupg). - `urlview` - outputs urls in mail to browser. ## Neomutt user interface @@ -88,8 +88,10 @@ To give you an example of the interface, here's an idea: - `?` - see all keyboard shortcuts - `ctrl-j`/`ctrl-k` - move up and down in sidebar, `ctrl-o` opens mailbox. - `ctrl-b` - open a menu to select a url you want to open in you browser. +- ## New stuff and improvements since the original release +- `mw` is now scriptable with command-line options and can run successfully without any interaction, making it possible to deploy in a script. - `isync`/`mbsync` has replaced `offlineimap` as the backend. Offlineimap was error-prone, bloated, used obsolete Python 2 modules and required separate steps to install the system. - `mw` is now an installed program instead of just a script needed to be kept in your mutt folder. - `dialog` is no longer used (le bloat) and the interface is simply text commands. diff --git a/bin/mw b/bin/mw index af4d785..9385bf5 100755 --- a/bin/mw +++ b/bin/mw @@ -337,7 +337,7 @@ Options allowed with -a: -x Password for account (recommended to be in double quotes) -p Install for a Protonmail account. -o Configure address, but keep mail online. - -b Assume typical English mailboxes without attempting log-on. + -f Assume typical English mailboxes without attempting log-on. NOTE: Once at least one account is added, you can run \`mbsync -a\` to begin downloading mail. diff --git a/bin/openfile b/bin/openfile index f6668dc..cf3c6c3 100755 --- a/bin/openfile +++ b/bin/openfile @@ -1,9 +1,10 @@ #!/bin/sh # Helps open a file with xdg-open from mutt in a external program without weird side effects. -[ "$(uname)" = "Darwin" ] && opener="open" || opener="setsid xdg-open" -mkdir -p "/tmp/$USER-mutt-tmp" -file="/tmp/$USER-mutt-tmp/$(basename "$1")" -rm -f "$file" -cp "$1" "$file" -$opener "$file" >/dev/null 2>&1 & +tempdir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard/files" +file="$tempdir/$(basename "$1")" +[ "$(uname)" = "Darwin" ] && opener="open" || opener="setsid -f xdg-open" +mkdir -p "$tempdir" +cp -f "$1" "$file" +$opener "$file" >/dev/null 2>&1 +find "${tempdir:?}" -mtime +1 -type f -delete diff --git a/share/mutt-wizard.muttrc b/share/mutt-wizard.muttrc index 94401e8..f40063d 100644 --- a/share/mutt-wizard.muttrc +++ b/share/mutt-wizard.muttrc @@ -4,6 +4,7 @@ # In the interest of seamless updating, do not edit this file. # If you want to override any settings, set those in your muttrc. set mailcap_path = /usr/local/share/mutt-wizard/mailcap +set mime_type_query_command = "file --mime-type -b %s" set date_format="%y/%m/%d %I:%M%p" set index_format="%2C %Z %?X?A& ? %D %-15.15F %s (%-4.4c)" set sort = 'reverse-date' -- cgit v1.2.3 From 44c70edd8175acb1a0d717c32e4048265c65cb8a Mon Sep 17 00:00:00 2001 From: Vlad Doster Date: Sat, 21 Nov 2020 02:06:33 -0600 Subject: Update README.md - Fix formatting, typos, and make the format cohesive. - Move LICENSE to defacto spot and more prominent - Move dependencies sections to be a sub-section of the Install section since it was a bit confusing as to why the dependencies were after the Install section. --- README.md | 198 ++++++++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 135 insertions(+), 63 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 31118f1..4b5d99d 100644 --- a/README.md +++ b/README.md @@ -3,29 +3,52 @@ Get this great stuff without effort: - A full-featured and autoconfigured email client on the terminal with neomutt -- Mail stored offline so you can view and write email while you're away from internet and keep backups +- Mail stored offline enabling the ability to: + * view and write emails while you're away from + the internet + * make backups Specifically, this wizard: - Determines your email server's IMAP and SMTP servers and ports -- Creates dotfiles for `neomutt`, `isync`, and `msmtp` appropriate for your email address -- Encrypts and locally stores your password for easy remote access, accessible only by your GPG key +- Creates dotfiles for `neomutt`, `isync`, and `msmtp` appropriate for your + email address +- Encrypts and locally stores your password for easy remote access, accessible + only by your GPG key - Handles as many as nine separate email accounts automatically - Auto-creates bindings to switch between accounts or between mailboxes -- Provides sensible defaults and an attractive appearance for the neomutt email client -- If mutt-wizard doesn't know your server's IMAP/SMTP info by default, it will prompt you for them and will put them in all the right places. +- Provides sensible defaults and an attractive appearance for the neomutt email + client +- If mutt-wizard doesn't know your server's IMAP/SMTP info by default, it will + prompt you for them and will put them in all the right places. -## Install and Use +## Install -``` +#### Dependencies + +- `neomutt` - the email client. +- `isync` - downloads and syncs the mail. (required at install) +- `msmtp` - sends the email. +- `pass` - safely encrypts passwords (required at install) + +**Note**: There's a chance of errors if you use a slow-release distro like Ubuntu, Debian, +or Mint. If you get errors in `neomutt`, install the most recent version +manually or manually remove the offending lines in the config in +`/usr/share/mutt-wizard/mutt-wizard.muttrc`. + +```bash git clone https://github.com/LukeSmithxyz/mutt-wizard cd mutt-wizard sudo make install ``` -User of Arch-based distros can also install mutt-wizard from the AUR as [mutt-wizard-git](https://aur.archlinux.org/packages/mutt-wizard-git/). +A user of Arch-based distros can also install mutt-wizard from the AUR as +[mutt-wizard-git](https://aur.archlinux.org/packages/mutt-wizard-git/). + +## Usage -The mutt-wizard is run with the command `mw`. Once everything is setup, you'll use `neomutt` to access your mail. +The mutt-wizard runs via the command `mw`. Once setup is complete, you'll use +`neomutt` to access your mail. - `mw -a you@email.com` -- add a new email account - `mw -l` -- list existing accounts @@ -40,96 +63,145 @@ The mutt-wizard is run with the command `mw`. Once everything is setup, you'll u #### Providing arguments - `-u` -- Give an account username if different from the email address. -- `-n` -- A real name to be used by the account. Put in quotations if multiple words +- `-n` -- A real name to be used by the account. Put in quotations if multiple + words - `-i` -- IMAP server address - `-I` -- IMAP server port (otherwise assumed to be 993) - `-s` -- SMTP server address - `-S` -- SMTP server port (otherwise assumed to be 587) -- `-m` -- Maximum number of emails to be kept offline. No maximum is default functionality. +- `-m` -- Maximum number of emails to be kept offline. No maximum is default + functionality. - `-x` -- Account password. You will be prompted for it otherwise. #### General Settings -- `-p` -- Add a Protonmail account -- `-f` -- Assume mailbox names and force account configuration without connecting online at all. +- `-p` -- Add a Protonmail account. +- `-f` -- Assume mailbox names and force account configuration without + connecting online at all. - `-o` -- Configure mutt for an account, but do not keep mail offline. -## Dependencies - -- `neomutt` - the email client. -- `isync` - downloads and syncs the mail. (required at install) -- `msmtp` - sends the email. -- `pass` - safely encrypts passwords (required at install) - -There's a chance of errors if you use a slow-release distro like Ubuntu, Debian or Mint. If you get errors in `neomutt`, install the most recent version manually or manually remove the offending lines in the config in `/usr/share/mutt-wizard/mutt-wizard.muttrc`. - -### Optional - -- `pam-gnupg` - Automatically logs you into your GPG key on login so you will never need to input your password once logged on to your system. Check the repo and directions out [here](https://github.com/cruegge/pam-gnupg). -- `lynx` - view HTML email in neomutt. -- `notmuch` - index and search mail. Install it and run `notmuch setup`, tell it that your mail is in `~/.local/share/mail/` (although `mw` will do this automatically if you haven't set notmuch up before). You can run it in mutt with `ctrl-f`. Run `notmuch new` to process new mail. -- `abook` - a terminal-based address book. Pressing tab while typing an address to send mail to will suggest contacts that are in your abook. -- `urlview` - outputs urls in mail to browser. - ## Neomutt user interface To give you an example of the interface, here's an idea: - `m` - send mail (uses your default `$EDITOR` to write) -- `j`/`k` and `d`/`u` - vim-like bindings to go down and up (or `d`/`u` to go down/up a page). +- `j`/`k` and `d`/`u` - vim-like bindings to go down and up (or `d`/`u` to go + down/up a page). - `l` - open mail, or attachment page or attachment - `h` - the opposite of `l` - `r`/`R` - reply/reply all to highlighted mail - `s` - save selected mail or selected attachment -- `gs`,`gi`,`ga`,`gd`,`gS` - Press `g` followed by another letter to change mailbox: `s`ent, `i`nbox, `a`rchive, `d`rafts, `S`pam, etc. -- `M` and `C` - For `M`ove and `C`opy: follow them with one of the mailbox letters above, i.e. `MS` means "move to Spam". -- `i#` - Press `i` followed by a number 1-9 to go to a different account. If you add 9 accounts via mutt-wizard, they will each be assigned a number. -- `a` to add address/person to abook and `Tab` while typing address to complete one from book. +- `gs`,`gi`,`ga`,`gd`,`gS` - Press `g` followed by another letter to change + mailbox: `s`ent, `i`nbox, `a`rchive, `d`rafts, `S`pam, etc. +- `M` and `C` - For `M`ove and `C`opy: follow them with one of the mailbox + letters above, i.e. `MS` means "move to Spam". +- `i#` - Press `i` followed by a number 1-9 to go to a different account. If you + add 9 accounts via mutt-wizard, they will each be assigned a number. +- `a` to add address/person to abook and `Tab` while typing address to complete + one from abook. - `?` - see all keyboard shortcuts - `ctrl-j`/`ctrl-k` - move up and down in sidebar, `ctrl-o` opens mailbox. -- `ctrl-b` - open a menu to select a url you want to open in you browser. -- +- `ctrl-b` - open a menu to select a URL you want to open in your browser. + +## Additional functionality + +- `pam-gnupg` - Automatically logs you into your GPG key on login, so you will + never need to input your password once logged on to your system. Check the + repo and directions out [here](https://github.com/cruegge/pam-gnupg). +- `lynx` - View HTML email in neomutt. +- `notmuch` - Index and search mail. Install it and run `notmuch setup`, tell it + that your mail is in `~/.local/share/mail/` (although `mw` will do this + automatically if you haven't set notmuch up before). You can run it in mutt + with `ctrl-f`. Run `notmuch new` to process new mail. +- `abook` - A terminal-based address book. Pressing tab while typing an address + to send mail to will suggest contacts that are in your abook. +- `urlview` - Outputs URLs in an email to your browser. + ## New stuff and improvements since the original release -- `mw` is now scriptable with command-line options and can run successfully without any interaction, making it possible to deploy in a script. -- `isync`/`mbsync` has replaced `offlineimap` as the backend. Offlineimap was error-prone, bloated, used obsolete Python 2 modules and required separate steps to install the system. -- `mw` is now an installed program instead of just a script needed to be kept in your mutt folder. -- `dialog` is no longer used (le bloat) and the interface is simply text commands. -- More autogenerated shortcuts that allow quickly moving and copying mail between boxes. -- More elegant attachment handling. Image/video/pdf attachments without relying on the neomutt instance. +- `mw` is now scriptable with command-line options and can run successfully + without any interaction, making it possible to deploy in a script. +- `isync`/`mbsync` has replaced `offlineimap` as the backend. Offlineimap was + error-prone, bloated, used obsolete Python 2 modules, and required separate + steps to install the system. +- `mw` is now an installed program instead of just a script needed to be kept in + your mutt folder. +- `dialog` is no longer used (i.e. bloat) and the interface is simply text + commands. +- More autogenerated shortcuts that allow quickly moving and copying mail + between boxes. +- More elegant attachment handling. Image/video/pdf attachments without relying + on the neomutt instance. - abook integration by default. -- The messy template files and other directories have been moved or removed, leaving a clean config folder. -- msmtp configs moved to `~/.config/` and mail default location moved to `~/.local/share/mail/`, reducing mess in `~`. +- The messy template files and other directories have been moved or removed, + leaving a clean config folder. +- msmtp configs moved to `~/.config/` and mail default location moved to + `~/.local/share/mail/`, reducing mess in `~`. - `pass` is used as a password manager instead of separately saving passwords. - Script is POSIX sh compliant. -- Error handling for the many people who don't read or follow directions. Less errors generally. +- Error handling for the many people who don't read or follow directions. Fewer + errors, generally. - Addition of a manual `man mw` ## Help the Project! -- Try mutt-wizard out on weird machines and weird email addresses and report any errors. -- Open a PR to add new server information into `domains.csv` so their users can more easily use mutt-wizard. +- Try mutt-wizard out on weird machines and weird email addresses and report any + errors. +- Open a PR to add new server information into `domains.csv` so their users can + more easily use mutt-wizard. - If nothing else, [Donate!](https://paypal.me/LukeMSmith) -See Luke's website [here](https://lukesmith.xyz). Email him at [luke@lukesmith.xyz](mailto:luke@lukesmith.xyz). - -mutt-wizard is free/libre software, licensed under the GPLv3. +See Luke's website [here](https://lukesmith.xyz). Email him at +[luke@lukesmith.xyz](mailto:luke@lukesmith.xyz). ## Details for Tinkerers - The critical `mutt`/`neomutt` files are in `~/.config/mutt/`. -- Put whatever global settings you want in `muttrc`. mutt-wizard will add some lines to this file which you shouldn't remove unless you know what you're doing, but you can move them up/down over your personal config lines if you need to. If you get binding conflict errors in mutt, you might need to do this. -- Each of the accounts that mutt-wizard generates will have custom settings set in a separate file in `accounts/`. You can edit these freely if you want to tinker with settings specific to an account. -- In `/usr/share/mutt-wizard` are several global config files, including `mutt-wizard`'s default settings. You can overwride this in your `muttrc` if you wish. - -## Watch out for these things: -- Gmail accounts can now create 'App Password' to use with """less secure""" applications. This password is single use (ie. for setup) and will be stored and encrypted locally. Enabling third-party applications requires turning off two-factor authentication and this will circumvent that. You might also need to manually "Enable IMAP" in the settings. -- Protonmail accounts will require you to set up "Protonmail Bridge" to access PM's IMAP and SMTP servers. Configure that before running mutt-wizard. Note that when mutt-wizard asks for a password, you should put in your [bridge password](https://protonmail.com/bridge/thunderbird#3), not your account password. -- Protonmail bridge is prone to timing out. Watch out for this while adding an account. If the bridge times out, try again. It might help to [increase the timeout](https://protonmail.com/support/knowledge-base/thunderbird-connection-server-timed-error/) in your `mbsyncrc`. -- If you have a university email, or enterprise-hosted email for work, there might be other hurdles or two-factor authentication you have to jump through. Some, for example, will want you to create a separate IMAP password, etc. - - `isync` is not fully UTF-8 compatible, so non-Latin characters may be garbled (although sync should succeed). `mw` will also not autocreate mailbox shortcuts since it is looking for English mailbox names. I strongly recommend you to set your email language to English on your mail server to avoid these problems. +- Put whatever global settings you want in `muttrc`. mutt-wizard will add some + lines to this file, which you shouldn't remove unless you know what you're + doing, but you can move them up/down over your config lines if you need to. If + you get binding conflict errors in mutt, you might need to do this. +- Each of the accounts that mutt-wizard generates will have custom settings set + in a separate file in `accounts/`. You can edit these freely if you want to + tinker with settings specific to an account. +- In `/usr/share/mutt-wizard` are several global config files, including + `mutt-wizard`'s default settings. You can override this in your `muttrc` if + you wish. + +## Watch out for these things + +- Gmail accounts need to create an [App + Password](https://support.google.com/accounts/answer/185833?hl=en) to use + with _**less secure**_ applications. This password is single-use (i.e. for + setup) and will be stored and encrypted locally. Enabling third-party + applications requires turning off two-factor authentication and this will + circumvent that. You might also need to manually "Enable IMAP" in the + settings. +- Protonmail accounts require a "Protonmail Bridge" to access + PM's IMAP and SMTP servers. Configure that before running mutt-wizard. Note + that when mutt-wizard asks for a password, you should put in your [bridge + password](https://protonmail.com/bridge/thunderbird#3), not your account + password. +- Protonmail bridge is prone to timing out. Watch out for this while adding an + account. If the bridge times out, try again. It might help to [increase the + timeout](https://protonmail.com/support/knowledge-base/thunderbird-connection-server-timed-error/) + in your `mbsyncrc`. +- If you have a university email or enterprise-hosted email for work, there + might be other hurdles or two-factor authentication you have to jump through. + Some, for example, will want you to create a separate IMAP password, etc. + - `isync` is not fully UTF-8 compatible, so non-Latin characters may be garbled + (although sync should succeed). `mw` will also not auto-create mailbox + shortcuts since it is looking for English mailbox names. I strongly recommend + you to set your email language to English on your mail server to avoid these + problems. ## To-do -- Add ~~Mac OS~~/~~BSD~~ compatibility (the script is confirmed to work for Mac OS and FreeBSD now) -- ~~Out-of-the-box compatibility with Protonmail Bridge~~ (I believe this is done, but more bug-testing is welcome since I don't have PM) +- [x] Add Mac OS/BSD compatibility + +- [x] Out-of-the-box compatibility with Protonmail Bridge (I believe this is + done, but more bug-testing is welcome since I don't have PM) + +## License + +[mutt-wizard](https://github.com/LukeSmithxyz/mutt-wizard) is free/libre software. This program is released under the GPLv3 license, which you can find in the file [LICENSE](LICENSE). -- cgit v1.2.3 From f589cd4dfdd00f8521c09548b77cba6f995f89a5 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 31 Dec 2020 12:28:15 -0500 Subject: workable mailsync readded to enable autosync the new script manually searches for environmental variables so that it can work from a cronjob and additionally searches for all Xorg displays on Linux so that the display notification should appear correctly no doubt there will be more bugs, but this is what the people want and it's worth working out --- README.md | 107 +++++++++++++++++++++++++++++++++++++++++++++-------------- bin/mailsync | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ bin/mw | 46 +++++++++++++++---------- mw.1 | 13 ++++++++ 4 files changed, 221 insertions(+), 43 deletions(-) create mode 100755 bin/mailsync (limited to 'README.md') diff --git a/README.md b/README.md index 31118f1..fc6999a 100644 --- a/README.md +++ b/README.md @@ -3,17 +3,24 @@ Get this great stuff without effort: - A full-featured and autoconfigured email client on the terminal with neomutt -- Mail stored offline so you can view and write email while you're away from internet and keep backups +- Mail stored offline so you can view and write email while you're away from + internet and keep backups +- Provides a `mailsync` script that can be scheduled to run as often as you + like, which downloads/syncs mail and notifies you when new mail has arrived. Specifically, this wizard: - Determines your email server's IMAP and SMTP servers and ports -- Creates dotfiles for `neomutt`, `isync`, and `msmtp` appropriate for your email address -- Encrypts and locally stores your password for easy remote access, accessible only by your GPG key +- Creates dotfiles for `neomutt`, `isync`, and `msmtp` appropriate for your + email address +- Encrypts and locally stores your password for easy remote access, accessible + only by your GPG key - Handles as many as nine separate email accounts automatically - Auto-creates bindings to switch between accounts or between mailboxes -- Provides sensible defaults and an attractive appearance for the neomutt email client -- If mutt-wizard doesn't know your server's IMAP/SMTP info by default, it will prompt you for them and will put them in all the right places. +- Provides sensible defaults and an attractive appearance for the neomutt email + client +- If mutt-wizard doesn't know your server's IMAP/SMTP info by default, it will + prompt you for them and will put them in all the right places. ## Install and Use @@ -33,6 +40,8 @@ The mutt-wizard is run with the command `mw`. Once everything is setup, you'll u - `mw -Y` -- sync all configured email accounts - `mw -d` -- choose an account to delete - `mw -D your@email.com` -- delete account settings without confirmation +- `mw -t 30` -- toggle automatic mailsync to every 30 minutes +- `mw -T` -- toggle mailsync without specifying minutes (default is 10) - `pass edit mw-your@email.com` -- revise an account's password ### Options usable when adding an account @@ -70,6 +79,7 @@ There's a chance of errors if you use a slow-release distro like Ubuntu, Debian - `notmuch` - index and search mail. Install it and run `notmuch setup`, tell it that your mail is in `~/.local/share/mail/` (although `mw` will do this automatically if you haven't set notmuch up before). You can run it in mutt with `ctrl-f`. Run `notmuch new` to process new mail. - `abook` - a terminal-based address book. Pressing tab while typing an address to send mail to will suggest contacts that are in your abook. - `urlview` - outputs urls in mail to browser. +- `cronie` - (or any other major cronjob manager) to set up automatic mail syncing. ## Neomutt user interface @@ -91,43 +101,90 @@ To give you an example of the interface, here's an idea: - ## New stuff and improvements since the original release -- `mw` is now scriptable with command-line options and can run successfully without any interaction, making it possible to deploy in a script. -- `isync`/`mbsync` has replaced `offlineimap` as the backend. Offlineimap was error-prone, bloated, used obsolete Python 2 modules and required separate steps to install the system. -- `mw` is now an installed program instead of just a script needed to be kept in your mutt folder. -- `dialog` is no longer used (le bloat) and the interface is simply text commands. -- More autogenerated shortcuts that allow quickly moving and copying mail between boxes. -- More elegant attachment handling. Image/video/pdf attachments without relying on the neomutt instance. +- `mw` is now scriptable with command-line options and can run successfully + without any interaction, making it possible to deploy in a script. +- `isync`/`mbsync` has replaced `offlineimap` as the backend. Offlineimap was + error-prone, bloated, used obsolete Python 2 modules and required separate + steps to install the system. +- `mw` is now an installed program instead of just a script needed to be kept + in your mutt folder. +- `dialog` is no longer used (le bloat) and the interface is simply text + commands. +- More autogenerated shortcuts that allow quickly moving and copying mail + between boxes. +- More elegant attachment handling. Image/video/pdf attachments without relying + on the neomutt instance. - abook integration by default. -- The messy template files and other directories have been moved or removed, leaving a clean config folder. -- msmtp configs moved to `~/.config/` and mail default location moved to `~/.local/share/mail/`, reducing mess in `~`. +- The messy template files and other directories have been moved or removed, + leaving a clean config folder. +- msmtp configs moved to `~/.config/` and mail default location moved to + `~/.local/share/mail/`, reducing mess in `~`. - `pass` is used as a password manager instead of separately saving passwords. - Script is POSIX sh compliant. -- Error handling for the many people who don't read or follow directions. Less errors generally. +- Error handling for the many people who don't read or follow directions. Less + errors generally. - Addition of a manual `man mw` ## Help the Project! -- Try mutt-wizard out on weird machines and weird email addresses and report any errors. -- Open a PR to add new server information into `domains.csv` so their users can more easily use mutt-wizard. +- Try mutt-wizard out on weird machines and weird email addresses and report + any errors. +- Open a PR to add new server information into `domains.csv` so their users can + more easily use mutt-wizard. - If nothing else, [Donate!](https://paypal.me/LukeMSmith) -See Luke's website [here](https://lukesmith.xyz). Email him at [luke@lukesmith.xyz](mailto:luke@lukesmith.xyz). +See Luke's website [here](https://lukesmith.xyz). Email him at +[luke@lukesmith.xyz](mailto:luke@lukesmith.xyz). mutt-wizard is free/libre software, licensed under the GPLv3. ## Details for Tinkerers - The critical `mutt`/`neomutt` files are in `~/.config/mutt/`. -- Put whatever global settings you want in `muttrc`. mutt-wizard will add some lines to this file which you shouldn't remove unless you know what you're doing, but you can move them up/down over your personal config lines if you need to. If you get binding conflict errors in mutt, you might need to do this. -- Each of the accounts that mutt-wizard generates will have custom settings set in a separate file in `accounts/`. You can edit these freely if you want to tinker with settings specific to an account. -- In `/usr/share/mutt-wizard` are several global config files, including `mutt-wizard`'s default settings. You can overwride this in your `muttrc` if you wish. +- Put whatever global settings you want in `muttrc`. mutt-wizard will add some + lines to this file which you shouldn't remove unless you know what you're + doing, but you can move them up/down over your personal config lines if you + need to. If you get binding conflict errors in mutt, you might need to do + this. +- Each of the accounts that mutt-wizard generates will have custom settings set + in a separate file in `accounts/`. You can edit these freely if you want to + tinker with settings specific to an account. +- In `/usr/share/mutt-wizard` are several global config files, including + `mutt-wizard`'s default settings. You can overwride this in your `muttrc` if + you wish. ## Watch out for these things: -- Gmail accounts can now create 'App Password' to use with """less secure""" applications. This password is single use (ie. for setup) and will be stored and encrypted locally. Enabling third-party applications requires turning off two-factor authentication and this will circumvent that. You might also need to manually "Enable IMAP" in the settings. -- Protonmail accounts will require you to set up "Protonmail Bridge" to access PM's IMAP and SMTP servers. Configure that before running mutt-wizard. Note that when mutt-wizard asks for a password, you should put in your [bridge password](https://protonmail.com/bridge/thunderbird#3), not your account password. -- Protonmail bridge is prone to timing out. Watch out for this while adding an account. If the bridge times out, try again. It might help to [increase the timeout](https://protonmail.com/support/knowledge-base/thunderbird-connection-server-timed-error/) in your `mbsyncrc`. -- If you have a university email, or enterprise-hosted email for work, there might be other hurdles or two-factor authentication you have to jump through. Some, for example, will want you to create a separate IMAP password, etc. - - `isync` is not fully UTF-8 compatible, so non-Latin characters may be garbled (although sync should succeed). `mw` will also not autocreate mailbox shortcuts since it is looking for English mailbox names. I strongly recommend you to set your email language to English on your mail server to avoid these problems. + +### Gmail + +Gmail accounts should require an +[application password](https://support.google.com/accounts/answer/185833) to +work unless you allow Gmail to access "less secure" applications. You may also +need to "Enable IMAP" in your Gmail settings. + +### Protonmail + +Protonmail accounts will require you to set up "Protonmail Bridge" to access +PM's IMAP and SMTP servers. Configure that before running mutt-wizard. Note +that when mutt-wizard asks for a password, you should put in your +[bridge password](https://protonmail.com/bridge/thunderbird#3), not your +account password. + +Protonmail bridge is prone to timing out. Watch out for this while adding an +account. If the bridge times out, try again. It might help to +[increase the timeout](https://protonmail.com/support/knowledge-base/thunderbird-connection-server-timed-error/) +in your `mbsyncrc`. + +### Other + +- If you have a university email, or enterprise-hosted email for work, there + might be other hurdles or two-factor authentication you have to jump through. + Some, for example, will want you to create a separate IMAP password, etc. + - `isync` is not fully UTF-8 compatible, so non-Latin characters may be + garbled (although sync should succeed). `mw` will also not autocreate + mailbox shortcuts since it is looking for English mailbox names. I strongly + recommend you to set your email language to English on your mail server to + avoid these problems. ## To-do diff --git a/bin/mailsync b/bin/mailsync new file mode 100755 index 0000000..02e4f98 --- /dev/null +++ b/bin/mailsync @@ -0,0 +1,98 @@ +#!/bin/sh + +# - Syncs mail for all accounts, or a single account given as an argument. +# - Displays a notification showing the number of new mails. +# - Displays a notification for each new mail with its subject displayed. +# - Runs notmuch to index new mail. +# - This script can be set up as a cron job for automated mail syncing. + +# There are many arbitrary and ugly features in this script because it is +# inherently difficult to pass environmental variables to cronjobs and other +# issues. It also should at least be compatible with Linux (and maybe BSD) with +# Xorg and MacOS as well. + +# Run only if user logged in (prevent cron errors) +pgrep -u "${USER:=$LOGNAME}" >/dev/null || { echo "$USER not logged in; sync will not run."; exit ;} +# Run only if not already running in other instance +pgrep -x mbsync >/dev/null && { echo "mbsync is already running." ; exit ;} + +# First, we have to get the right variables for the mbsync file, the pass +# archive, notmuch and the GPG home. This is done by searching common profile +# files for variable assignments. This is ugly, but there are few options that +# will work on the maximum number of machines. +eval `grep -h -- \ + "^\(export \)\?\(MBSYNCRC\|PASSWORD_STORE_DIR\|NOTMUCH_CONFIG\|GNUPGHOME\)=" \ + "$HOME/.profile" "$HOME/.bash_profile" "$HOME/.zprofile" "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.pam_environment" 2>/dev/null` +# One alternative to this kind of command would be marking the script for +# /bin/sh -l. That might cause other problems on other particular setups that +# do more complicated things on login, or those people who assign environmental +# variables in shell rc files. + +# This variable might be required for soysdemd users, but it will break the +# script on Artix runit. +# export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus +export GPG_TTY=$TTY + +[ -n "$MBSYNCRC" ] && alias mbsync="mbsync -c $MBSYNCRC" || MBSYNCRC="$HOME/.mbsyncrc" + +# Settings are different for MacOS (Darwin) systems. +case "$(uname)" in + Darwin) + notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $account\"" && sleep 2 ;} + messageinfo() { osascript -e "display notification with title \"📧 $from\" subtitle \"$subject\"" ;} + ;; + *) + displays="$(ps axo user,cmd | grep "^$USER\s\+.*Xorg" | grep -wo "[0-9]*:[0-9]\+")" + notify() { for x in $displays; do + export DISPLAY=$x + notify-send --app-name="mutt-wizard" "mutt-wizard" "📬 $2 new mail(s) in \`$1\` account." + done ;} + messageinfo() { for x in $displays; do + export DISPLAY=$x + notify-send --app-name="mutt-wizard" "📧$from:" "$subject" + done ;} + ;; +esac + +# Check account for new mail. Notify if there is new content. +syncandnotify() { + acc="$(echo "$account" | sed "s/.*\///")" + if [ -z "$opts" ]; then mbsync "$acc"; else mbsync "$opts" "$acc"; fi + new=$(find "$HOME/.local/share/mail/$acc/INBOX/new/" "$HOME/.local/share/mail/$acc/Inbox/new/" "$HOME/.local/share/mail/$acc/inbox/new/" -type f -newer "$HOME/.config/mutt/.mailsynclastrun" 2> /dev/null) + newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l) + if [ "$newcount" -gt "0" ]; then + notify "$acc" "$newcount" & + for file in $new; do + # Extract subject and sender from mail. + from=$(awk '/^From: / && ++n ==1,/^\<.*\>:/' "$file" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | awk '{ $1=""; if (NF>=3)$NF=""; print $0 }' | sed 's/^[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//') + subject=$(awk '/^Subject: / && ++n == 1,/^\<.*\>: / && ++i == 2' "$file" | head -n 1 | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | sed 's/^Subject: //' | sed 's/^{[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//' | tr -d '\n') + messageinfo & + done + fi +} + +# Sync accounts passed as argument or all. +if [ "$#" -eq "0" ]; then + accounts="$(awk '/^Channel/ {print $2}' "$MBSYNCRC")" +else + for arg in "$@"; do + [ "${arg%${arg#?}}" = '-' ] && opts="${opts:+${opts} }${arg}" && shift 1 + done + accounts=$* +fi + +#( kill -46 "$(pidof "${STATUSBAR:-dwmblocks}")" >/dev/null 2>&1 ) 2>/dev/null + +# Parallelize multiple accounts +for account in $accounts +do + syncandnotify & +done + +wait +#( kill -46 "$(pidof "${STATUSBAR:-dwmblocks}")" >/dev/null 2>&1 ) 2>/dev/null + +notmuch new 2>/dev/null + +#Create a touch file that indicates the time of the last run of mailsync +touch "$HOME/.config/mutt/.mailsynclastrun" diff --git a/bin/mw b/bin/mw index a207d4e..f713761 100755 --- a/bin/mw +++ b/bin/mw @@ -21,7 +21,7 @@ cachedir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard" muttrc="$muttdir/muttrc" msmtprc="${XDG_CONFIG_HOME:-$HOME/.config}/msmtp/config" msmtplog="${XDG_CONFIG_HOME:-$HOME/.config}/msmtp/msmtp.log" -MARKER="# mw-autogenerated" +marker="# mw-autogenerated" alias mbsync='mbsync -c "$mbsyncrc"' for x in "/etc/ssl/certs/ca-certificates.crt" "/etc/pki/tls/certs/ca-bundle.crt" "/etc/ssl/ca-bundle.pem" "/etc/pki/tls/cacert.pem" "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem" "/etc/ssl/cert.pem" "/usr/local/share/ca-certificates/" @@ -151,7 +151,7 @@ delete() { if [ -z "${fulladdr+x}" ]; then [ -z "$fulladdr" ] && echo "Invalid account name given." && return 1 - sed -ibu "/IMAPStore $fulladdr-remote$/,/# End profile/d" "$mbsyncrc" ; rm -rf "$mbsyncrc"bu + sed -ibu "/IMAPStore $fulladdr-remote$/,/# End profile/d" "$mbsyncrc" ; rm -f "$mbsyncrc"bu rm -rf "${cachedir:?}/${fulladdr:?}" "$accdir/"[1-9]"-$fulladdr.muttrc" sed -ibu "/[0-9]-$fulladdr.muttrc/d" "$muttrc" ; rm -f "$muttrc"bu sed -ibu "/account $fulladdr/,/^\(\s*$\|account\)/d" "$msmtprc"; rm -f "$msmtprc"bu @@ -205,9 +205,9 @@ writeinfo() { mkdir -p "$muttdir" "$accdir" "$cachedir/$fulladdr/bodies" "${XDG_ # Create a muttrc for viewing mail. echo "$mutt_profile" > "$accdir/$idnum-$fulladdr.muttrc" [ ! -f "$muttrc" ] && echo "# vim: filetype=neomuttrc" > "$muttrc" - ! grep -q "^source.*mutt-wizard.muttrc" "$muttrc" && echo "source $mwconfig $MARKER" >> "$muttrc" - ! grep "^source.*.muttrc" "$muttrc" | grep -qv "$mwconfig" && echo "source $accdir/$idnum-$fulladdr.muttrc $MARKER" >> "$muttrc" - echo "macro index,pager i$idnum 'source $accdir/$idnum-$fulladdr.muttrc!;' \"switch to $fulladdr\" $MARKER" >> "$muttrc" + ! grep -q "^source.*mutt-wizard.muttrc" "$muttrc" && echo "source $mwconfig $marker" >> "$muttrc" + ! grep "^source.*.muttrc" "$muttrc" | grep -qv "$mwconfig" && echo "source $accdir/$idnum-$fulladdr.muttrc $marker" >> "$muttrc" + echo "macro index,pager i$idnum 'source $accdir/$idnum-$fulladdr.muttrc!;' \"switch to $fulladdr\" $marker" >> "$muttrc" notmuchauto # Create a notmuch config file if not present already. } @@ -216,12 +216,12 @@ getpass() { while : ; do pass rm -f "$pass_prefix$fulladdr" >/dev/null 2>&1 pass insert "$pass_prefix$fulladdr" && break; done ;} formatShortcut() { toappend="$toappend -macro index,pager g$1 \"=$3\" \"go to $2\" $MARKER -macro index,pager M$1 \";=$3\" \"move mail to $2\" $MARKER -macro index,pager C$1 \";=$3\" \"copy mail to $2\" $MARKER" >> "$accdir/$idnum-$fulladdr.muttrc" ;} +macro index,pager g$1 \"=$3\" \"go to $2\" $marker +macro index,pager M$1 \";=$3\" \"move mail to $2\" $marker +macro index,pager C$1 \";=$3\" \"copy mail to $2\" $marker" >> "$accdir/$idnum-$fulladdr.muttrc" ;} setBox() { toappend="$toappend -set $1 = \"+$2\" $MARKER" ;} +set $1 = \"+$2\" $marker" ;} getboxes() { [ -n "${force+x}" ] && mailboxes="INBOX Drafts @@ -239,7 +239,7 @@ Archive" && return 0 fi ;} finalize() { echo "$mailboxes" | xargs -I {} mkdir -p "$maildir/$fulladdr/{}/cur" "$maildir/$fulladdr/{}/tmp" "$maildir/$fulladdr/{}/new" - sed -ibu "/$MARKER/d" "$accdir/$idnum-$fulladdr.muttrc" ; rm -f "$accdir/$idnum-$fulladdr.muttrcbu" + sed -ibu "/$marker/d" "$accdir/$idnum-$fulladdr.muttrc" ; rm -f "$accdir/$idnum-$fulladdr.muttrcbu" toappend="mailboxes $(echo "$mailboxes" | sed "s/^/\"=/;s/$/\"/" | paste -sd ' ' - )" for x in $mailboxes; do case "$x" in @@ -257,12 +257,6 @@ finalize() { echo "$mailboxes" | xargs -I {} mkdir -p "$maildir/$fulladdr/{}/cur command -V urlview >/dev/null 2>&1 && [ ! -f "$HOME/.urlview" ] && echo "COMMAND \$BROWSER" > "$HOME/.urlview" return 0 ;} -syncwrapper() { mbsync "${1:--a}" & - ( kill -46 "$(pidof "${STATUSBAR:-dwmblocks}")" >/dev/null 2>&1 ) 2>/dev/null - wait - ( kill -46 "$(pidof "${STATUSBAR:-dwmblocks}")" >/dev/null 2>&1 ) 2>/dev/null - notmuch new ;} - notmuchauto() { \ [ -z "$NOTMUCH_CONFIG" ] && NOTMUCH_CONFIG="$HOME/.notmuch-config" [ -f "$NOTMUCH_CONFIG" ] && return 0 @@ -282,6 +276,17 @@ synchronize_flags=true gpg_path=$GPG" echo "$nmbasic" > "$NOTMUCH_CONFIG" ;} +togglecron() { cron="$(mktemp)" + crontab -l > "$cron" + if grep -q mailsync "$cron"; then + echo "Removing automatic mailsync..." + sed -ibu /mailsync/d "$cron"; rm -f "$cron"bu + else + echo "Adding automatic mailsync every ${cronmin:-10} minutes..." + echo "*/${cronmin-10} * * * * /usr/local/bin/mailsync" >> "$cron" + fi && + crontab "$cron"; rm -f "$cron" ;} + setact() { if [ -n "${action+x}" ] && [ "$action" != "$1" ]; then echo "Running $1 with $action..." echo "Incompatible options given. Only one action may be specified per run." @@ -292,7 +297,7 @@ setact() { if [ -n "${action+x}" ] && [ "$action" != "$1" ]; then trap 'echo -e "\033[0m\n"; exit' INT ABRT -while getopts "fplhodYD:y:i:I:s:S:u:a:n:x:m:" o; do case "${o}" in +while getopts "fplhodTYD:y:i:I:s:S:u:a:n:x:m:t:" o; do case "${o}" in l) setact list || exit 1 ;; d) setact delete || exit 1 ;; D) setact delete || exit 1 ; fulladdr="$OPTARG" ;; @@ -309,6 +314,8 @@ while getopts "fplhodYD:y:i:I:s:S:u:a:n:x:m:" o; do case "${o}" in o) setact add || exit 1 ; online=True ;; f) setact add || exit 1 ; force=True ;; x) setact add || exit 1 ; password="$OPTARG" ;; + t) setact toggle || exit 1 ; cronmin="$OPTARG" ;; + T) setact toggle || exit 1 ;; p) echo "NOTE: Protonmail users must install and configure Protonmail Bridge first for the first sync to work." imap="127.0.0.1" iport="1143" @@ -329,6 +336,8 @@ Main actions: -D your@email.com Force remove account without confirmation -y your@email.com Sync mail for account by name -Y Sync mail for all accounts + -t number Toggle automatic mailsync every minutes + -T Toggle automatic mailsync Options allowed with -a: -u Account login name if not full address @@ -357,5 +366,6 @@ case "$action" in list) list ;; add) askinfo && getprofiles && writeinfo && getboxes && finalize || { delete ; exit 1 ;} ;; delete) delete $fulladdr ;; - sync) syncwrapper $fulladdr ;; + sync) mailsync $fulladdr ;; + toggle) togglecron ;; esac diff --git a/mw.1 b/mw.1 index 3ed4d95..920e513 100644 --- a/mw.1 +++ b/mw.1 @@ -35,6 +35,12 @@ download and upload mail for an email account .TP .B -Y sync all email accounts +.TP +.B -t 15 +toggle a cronjob that syncs your mail every 15 minutes (or any other number under 60) +.TP +.B -T +toggle a cronjob without specifying minutes between sync .SH OPTIONS FOR ADDING ACCOUNTS These can be specified on the command line, otherwise, you will be prompted for what is necessary. mutt-wizard knows the IMAP/SMTP server information for most email providers, so specifying them is usually redundant. .TP @@ -75,6 +81,13 @@ connection will still be attempted in setup to discover mailboxes. Add a Protonmail account. Protonmail Bridge must be installed and set up. .SH DETAILS .TP +.B mailsync +mutt-wizard calls a script +.I mailsync +to sync mail. This script additionally indexes new mail with notmuch and gives you a notification if new mail has arrived. If you want to bypass its additional features, you can always just run +.I mbsync -a +to sync your mail directly. +.TP .B Mail location If the user chooses to keep offline email with .B isync, -- cgit v1.2.3 From ca9f1a12ccbc01889fd2a1257462594e4d2ea272 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Wed, 6 Jan 2021 21:13:48 -0500 Subject: use curl to login rm mbsync requirement for online storage --- README.md | 5 +++-- bin/mw | 17 ++++++----------- 2 files changed, 9 insertions(+), 13 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index fc6999a..46c4a36 100644 --- a/README.md +++ b/README.md @@ -66,9 +66,10 @@ The mutt-wizard is run with the command `mw`. Once everything is setup, you'll u ## Dependencies - `neomutt` - the email client. -- `isync` - downloads and syncs the mail. (required at install) +- `curl` - tests connections (required at install). +- `isync` - downloads and syncs the mail (required if storing IMAP mail locally). - `msmtp` - sends the email. -- `pass` - safely encrypts passwords (required at install) +- `pass` - safely encrypts passwords (required at install). There's a chance of errors if you use a slow-release distro like Ubuntu, Debian or Mint. If you get errors in `neomutt`, install the most recent version manually or manually remove the offending lines in the config in `/usr/share/mutt-wizard/mutt-wizard.muttrc`. diff --git a/bin/mw b/bin/mw index 3586df7..f009e90 100755 --- a/bin/mw +++ b/bin/mw @@ -199,9 +199,8 @@ writeinfo() { mkdir -p "$muttdir" "$accdir" "$cachedir/$fulladdr/bodies" "${XDG_ # On Ubuntu/Debian, a link is needed since they use an older version. command -V apt-get >/dev/null 2>&1 && ln -s "$msmtprc" "$HOME/.msmtprc" 2>/dev/null - # Create the mbsync config file. - mkdir -p "${mbsyncrc%/*}" - echo "$mbsync_profile" >> "$mbsyncrc" + # Create the mbsync config file if local account. + [ -z "${online+x}" ] && mkdir -p "${mbsyncrc%/*}" && echo "$mbsync_profile" >> "$mbsyncrc" # Create a muttrc for viewing mail. echo "$mutt_profile" > "$accdir/$idnum-$fulladdr.muttrc" @@ -230,14 +229,10 @@ Junk Trash Sent Archive" && return 0 - if mailboxes="$(mbsync -l "$fulladdr" | sed 's/\//./')" >/dev/null 2>&1 && [ -n "$mailboxes" ]; then - [ -n "${online+x}" ] && sed -ibu "/IMAPStore $fulladdr-remote$/,/# End profile/d" "$mbsyncrc" ; rm -f "$mbsyncrc"bu - return 0 - else - echo "$mailboxes" - echo "Log-on not successful." - return 1 - fi ;} + info="$(curl -s --user "$login:$(pass $pass_prefix$fulladdr)" --url "${protocol:-imaps}://$imap")" || + { echo "Log-on not successful." ; exit 1 ;} + mailboxes="$(echo "$info" | sed "s/.*\" //" | tr -d ' ')" +} finalize() { echo "$mailboxes" | xargs -I {} mkdir -p "$maildir/$fulladdr/{}/cur" "$maildir/$fulladdr/{}/tmp" "$maildir/$fulladdr/{}/new" sed -ibu "/$marker/d" "$accdir/$idnum-$fulladdr.muttrc" ; rm -f "$accdir/$idnum-$fulladdr.muttrcbu" -- cgit v1.2.3 From 16de5dc350d06cd45338271a2286c0629ef20435 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Wed, 6 Jan 2021 21:38:25 -0500 Subject: don't ask realname if not given; assume userid --- README.md | 2 +- bin/mw | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 46c4a36..a68e298 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ The mutt-wizard is run with the command `mw`. Once everything is setup, you'll u #### Providing arguments - `-u` -- Give an account username if different from the email address. -- `-n` -- A real name to be used by the account. Put in quotations if multiple words +- `-n` -- A real name to be used by the account. Put in quotations if multiple words. - `-i` -- IMAP server address - `-I` -- IMAP server port (otherwise assumed to be 993) - `-s` -- SMTP server address diff --git a/bin/mw b/bin/mw index 9950fae..0c00e53 100755 --- a/bin/mw +++ b/bin/mw @@ -180,8 +180,7 @@ askinfo() { \ [ -z "$smtp" ] && echo "Give your email server's SMTP address (excluding the port number):" && read -r smtp [ "$sport" = 465 ] && tlsline="tls_starttls off" - [ -z "$realname" ] && echo "Give the name you would like to be identified by on the email account:" && - read -r realname + [ -z "$realname" ] && realname="${fulladdr%%@*}" login="${login:-$fulladdr}" if [ -n "${password+x}" ]; then createpass -- cgit v1.2.3 From c05b6aa92c64728f8f2f80c5d31317e098346596 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 7 Jan 2021 18:35:06 -0500 Subject: final --- README.md | 55 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 24 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 003ff58..700de00 100644 --- a/README.md +++ b/README.md @@ -34,9 +34,9 @@ Specifically, this wizard: - `msmtp` - sends the email. - `pass` - safely encrypts passwords (required at install). -**Note**: There's a chance of errors if you use a slow-release distro like Ubuntu, Debian, -or Mint. If you get errors in `neomutt`, install the most recent version -manually or manually remove the offending lines in the config in +**Note**: There's a chance of errors if you use a slow-release distro like +Ubuntu, Debian, or Mint. If you get errors in `neomutt`, install the most +recent version manually or manually remove the offending lines in the config in `/usr/share/mutt-wizard/mutt-wizard.muttrc`. ```bash @@ -50,12 +50,19 @@ A user of Arch-based distros can also install mutt-wizard from the AUR as ### Optional Dependencies -- `pam-gnupg` - Automatically logs you into your GPG key on login so you will never need to input your password once logged on to your system. Check the repo and directions out [here](https://github.com/cruegge/pam-gnupg). +- `pam-gnupg` - Automatically logs you into your GPG key on login so you will + never need to input your password once logged on to your system. Check the + repo and directions out [here](https://github.com/cruegge/pam-gnupg). - `lynx` - view HTML email in neomutt. -- `notmuch` - index and search mail. Install it and run `notmuch setup`, tell it that your mail is in `~/.local/share/mail/` (although `mw` will do this automatically if you haven't set notmuch up before). You can run it in mutt with `ctrl-f`. Run `notmuch new` to process new mail. -- `abook` - a terminal-based address book. Pressing tab while typing an address to send mail to will suggest contacts that are in your abook. +- `notmuch` - index and search mail. Install it and run `notmuch setup`, tell + it that your mail is in `~/.local/share/mail/` (although `mw` will do this + automatically if you haven't set notmuch up before). You can run it in mutt + with `ctrl-f`. Run `notmuch new` to process new mail. +- `abook` - a terminal-based address book. Pressing tab while typing an address + to send mail to will suggest contacts that are in your abook. - `urlview` - outputs urls in mail to browser. -- `cronie` - (or any other major cronjob manager) to set up automatic mail syncing. +- `cronie` - (or any other major cronjob manager) to set up automatic mail + syncing. ## Usage @@ -185,38 +192,38 @@ See Luke's website [here](https://lukesmith.xyz). Email him at ## Watch out for these things -- Gmail accounts need to create an [App - Password](https://support.google.com/accounts/answer/185833?hl=en) to use - with _**less secure**_ applications. This password is single-use (i.e. for - setup) and will be stored and encrypted locally. Enabling third-party +- Gmail accounts need to create an +- [App Password](https://support.google.com/accounts/answer/185833?hl=en) to + use with _**less secure**_ applications. This password is single-use (i.e. + for setup) and will be stored and encrypted locally. Enabling third-party applications requires turning off two-factor authentication and this will circumvent that. You might also need to manually "Enable IMAP" in the settings. - Protonmail accounts require a "Protonmail Bridge" to access PM's IMAP and SMTP servers. Configure that before running mutt-wizard. Note - that when mutt-wizard asks for a password, you should put in your [bridge - password](https://protonmail.com/bridge/thunderbird#3), not your account - password. + that when mutt-wizard asks for a password, you should put in your + [bridge password](https://protonmail.com/bridge/thunderbird#3), not your + account password. - Protonmail bridge is prone to timing out. Watch out for this while adding an - account. If the bridge times out, try again. It might help to [increase the - timeout](https://protonmail.com/support/knowledge-base/thunderbird-connection-server-timed-error/) + account. If the bridge times out, try again. It might help to + [increase the timeout](https://protonmail.com/support/knowledge-base/thunderbird-connection-server-timed-error/) in your `mbsyncrc`. - If you have a university email or enterprise-hosted email for work, there might be other hurdles or two-factor authentication you have to jump through. Some, for example, will want you to create a separate IMAP password, etc. - - `isync` is not fully UTF-8 compatible, so non-Latin characters may be garbled - (although sync should succeed). `mw` will also not auto-create mailbox - shortcuts since it is looking for English mailbox names. I strongly recommend - you to set your email language to English on your mail server to avoid these - problems. +- `isync` is not fully UTF-8 compatible, so non-Latin characters may be garbled + (although sync should succeed). `mw` will also not auto-create mailbox + shortcuts since it is looking for English mailbox names. I strongly recommend + you to set your email language to English on your mail server to avoid these + problems. ## To-do - [x] Add Mac OS/BSD compatibility - - [x] Out-of-the-box compatibility with Protonmail Bridge (I believe this is done, but more bug-testing is welcome since I don't have PM) - + ## License -[mutt-wizard](https://github.com/LukeSmithxyz/mutt-wizard) is free/libre software. This program is released under the GPLv3 license, which you can find in the file [LICENSE](LICENSE). +mutt-wizard is free/libre software. This program is released under the GPLv3 +license, which you can find in the file [LICENSE](LICENSE). -- cgit v1.2.3 From 3f54e68365bdba9eaa59c496fd7c2a933f2f8081 Mon Sep 17 00:00:00 2001 From: Kr1ss Date: Fri, 8 Jan 2021 22:02:33 +0100 Subject: [README] add info and link to stable AUR package Since version tags/releases have been introduced lately, Arch users are now able to choose between a 'stable' and a 'development' package. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 700de00..bf17925 100644 --- a/README.md +++ b/README.md @@ -45,8 +45,8 @@ cd mutt-wizard sudo make install ``` -A user of Arch-based distros can also install mutt-wizard from the AUR as -[mutt-wizard-git](https://aur.archlinux.org/packages/mutt-wizard-git/). +A user of Arch-based distros can also install the current mutt-wizard release from the AUR as +[mutt-wizard](https://aur.archlinux.org/packages/mutt-wizard/), or the Github master branch, [mutt-wizard-git](https://aur.archlinux.org/packages/mutt-wizard-git/). ### Optional Dependencies -- cgit v1.2.3 From dccd4d4cbf741c2c0d06e761bc1fb63561d5f1e6 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Mon, 1 Feb 2021 13:51:12 -0500 Subject: dox --- README.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index bf17925..93bbf0a 100644 --- a/README.md +++ b/README.md @@ -193,7 +193,7 @@ See Luke's website [here](https://lukesmith.xyz). Email him at ## Watch out for these things - Gmail accounts need to create an -- [App Password](https://support.google.com/accounts/answer/185833?hl=en) to + [App Password](https://support.google.com/accounts/answer/185833?hl=en) to use with _**less secure**_ applications. This password is single-use (i.e. for setup) and will be stored and encrypted locally. Enabling third-party applications requires turning off two-factor authentication and this will @@ -217,12 +217,6 @@ See Luke's website [here](https://lukesmith.xyz). Email him at you to set your email language to English on your mail server to avoid these problems. -## To-do - -- [x] Add Mac OS/BSD compatibility -- [x] Out-of-the-box compatibility with Protonmail Bridge (I believe this is - done, but more bug-testing is welcome since I don't have PM) - ## License mutt-wizard is free/libre software. This program is released under the GPLv3 -- cgit v1.2.3 From d6d241a5fdab1329f3d7e7b212346d4c336f223c Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 5 Feb 2021 16:25:40 -0500 Subject: POP support added with mpop. Closes #609 --- README.md | 4 ++++ bin/mw | 26 +++++++++++++++----------- mw.1 | 14 ++++++++++++-- 3 files changed, 31 insertions(+), 13 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 93bbf0a..2aee255 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,7 @@ A user of Arch-based distros can also install the current mutt-wizard release fr - `urlview` - outputs urls in mail to browser. - `cronie` - (or any other major cronjob manager) to set up automatic mail syncing. +- `mpop` - If you want to use POP protocol instead of IMAP. ## Usage @@ -101,6 +102,7 @@ The mutt-wizard runs via the command `mw`. Once setup is complete, you'll use - `-f` -- Assume mailbox names and force account configuration without connecting online at all. - `-o` -- Configure mutt for an account, but do not keep mail offline. +- `-P` -- Use POP protocol instead of IMAP (requires `mpop` installed). ## Neomutt user interface @@ -163,6 +165,8 @@ To give you an example of the interface, here's an idea: - Error handling for the many people who don't read or follow directions. Fewer errors generally. - Addition of a manual `man mw` +- Now handles POP protocol via `mpop` for those who prefer it (add an account + with the `-P` option). POP configs are still generated automatically. ## Help the Project! diff --git a/bin/mw b/bin/mw index 58b5f0f..129cda2 100755 --- a/bin/mw +++ b/bin/mw @@ -27,7 +27,7 @@ checkbasics() { command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2" getaccounts() { accounts="$(find -L "$accdir" -type f 2>/dev/null | grep -o "[0-9]-.*.muttrc" | sed "s/-/: /;s/\.muttrc$//" | sort -n)" ;} -list() { getaccounts && [ -n "$accounts" ] && echo "$accounts" ;} +list() { getaccounts && [ -n "$accounts" ] && echo "$accounts" || exit 1 ;} prepmsmtp() { echo "account $fulladdr host $smtp @@ -72,7 +72,8 @@ ExpireUnread no # End profile " >> "$mbsyncrc" ;} -prepmpop() { echo " +prepmpop() { mkdir -p "${mpoprc%/*}" + echo " account $fulladdr tls on user $login @@ -126,6 +127,7 @@ set ssl_starttls = yes set ssl_force_tls = yes" ;; pop) synccmd="macro index o \"mpop $fulladdr\" \"run mpop to get $fulladdr's mail\"" + folder="$maildir/$fulladdr" prepmpop ;; *) synccmd="macro index o \"mw -y $fulladdr\" \"run mbsync to sync $fulladdr\"" folder="$maildir/$fulladdr" @@ -152,7 +154,7 @@ EOF delete() { if [ -z "${fulladdr+x}" ]; then echo "Select the account your would like to delete (by number):" - list + list || exit 1 read -r input match="^$input:" else @@ -162,18 +164,19 @@ delete() { if [ -z "${fulladdr+x}" ]; then fulladdr="$(echo "$accounts" | grep "$match" | cut -f2 -d' ')" - [ -z "$fulladdr" ] && echo "Invalid account name given." && return 1 + [ -z "$fulladdr" ] && echo "$fulladdr is not a valid account name." && return 1 - sed -ibu "/IMAPStore $fulladdr-remote$/,/# End profile/d" "$mbsyncrc" ; rm -f "$mbsyncrc"bu + sed -ibu "/IMAPStore $fulladdr-remote$/,/# End profile/d" "$mbsyncrc" 2>/dev/null ; rm -f "$mbsyncrc"bu rm -rf "${cachedir:?}/${fulladdr:?}" "$accdir/"[1-9]"-$fulladdr.muttrc" - sed -ibu "/[0-9]-$fulladdr.muttrc/d" "$muttrc" ; rm -f "$muttrc"bu - sed -ibu "/account $fulladdr/,/^\(\s*$\|account\)/d" "$msmtprc"; rm -f "$msmtprc"bu + sed -ibu "/[0-9]-$fulladdr.muttrc/d" "$muttrc" 2>/dev/null; rm -f "$muttrc"bu + sed -ibu "/account $fulladdr$/,/^\(\s*$\|account\)/d" "$msmtprc" 2>/dev/null; rm -f "$msmtprc"bu + sed -ibu "/account $fulladdr$/,/^\(\s*$\|account\)/d" "$mpoprc" 2>/dev/null; rm -f "$mpoprc"bu pass rm -f "$fulladdr" >/dev/null 2>&1 [ -n "${purge+x}" ] && rm -rf "${maildir:?}/${fulladdr:?}" # Get rid of those multiple newlines because I don't know awk well enough to do it by default lol. - for file in "$msmtprc" "$mbsyncrc"; do - tr '\n' '|' < "$file" | sed "s/||\+/||/g" | tr '|' '\n' >> "$file"bu + for file in "$msmtprc" "$mbsyncrc" "$mpoprc"; do + tr '\n' '|' < "$file" 2>/dev/null | sed "s/||\+/||/g" | tr '|' '\n' >> "$file"bu mv -f "$file"bu "$file" done } @@ -217,13 +220,14 @@ macro index,pager C$1 \";=$3\" \"copy mail to $2\"" ;} setBox() { toappend="$toappend set $1 = \"+$2\"" ;} -getboxes() { if [ -n "${force+x}" ]; then +getboxes() { if [ -n "${force+x}" ] ; then mailboxes="$(printf "INBOX\\nDrafts\\nJunk\\nTrash\\nSent\\nArchive")" else info="$(curl --location-trusted -s -m 5 --user "$login:$(pass $fulladdr)" --url "${protocol:-imaps}://$imap:${iport:-993}")" [ -z "$info" ] && echo "Log-on not successful." && return 1 mailboxes="$(echo "$info" | grep -v HasChildren | sed "s/.*\" //;s/\"//g" | tr -d ' ')" fi + [ "$type" = "pop" ] && mailboxes="INBOX" getaccounts; for x in $(seq 1 9); do echo "$accounts" | grep -q "^$x:" || { export idnum="$x"; break ;}; done toappend="mailboxes $(echo "$mailboxes" | sed "s/^/\"=/;s/$/\"/" | paste -sd ' ' - )" for x in $mailboxes; do @@ -333,7 +337,7 @@ while getopts "fpPXlhodTYD:y:i:I:s:S:u:a:n:x:m:t:" o; do case "${o}" in n) setact add || exit 1 ; realname="$OPTARG" ;; m) setact add || exit 1 ; maxmes="$OPTARG" ;; o) setact add || exit 1 ; type="online" ;; - P) setact add || exit 1 ; type="pop" ;; + P) setact add || exit 1 ; type="pop"; protocol="pop3s" ; iport="${iport:-995}" ;; f) setact add || exit 1 ; force=True ;; x) setact add || exit 1 ; password="$OPTARG" ;; X) setact delete || exit 1 ; purge=True ;; diff --git a/mw.1 b/mw.1 index a9ea0bd..26d9569 100644 --- a/mw.1 +++ b/mw.1 @@ -54,10 +54,10 @@ Real name which will appear in emails. Should be put in quotes if multiple words Set a maximum number of messages to be stored offline. .TP .B -i -IMAP server address +IMAP/POP server address .TP .B -I -IMAP server port (assumed to be 993 if not specified) +IMAP/POP server port (assumed to be 993 for IMAP and 995 for POP if not specified) .TP .B -s SMTP server address @@ -86,6 +86,15 @@ When removing an email profile with either or .I -D, also delete the local mail (will not delete the mail on the server). +.TP +.B -P +Use POP protocol instead of IMAP. Requires +.I mpop +to download mail after configuration. Server details can still be given with the +.I -i +and +.I -I +options as if it were a IMAP. .SH DETAILS .TP .B mailsync @@ -287,6 +296,7 @@ GPLv3 .BR neomutt (1), .BR neomuttrc (1) .BR mbsync (1), +.BR mpop (1), .BR msmtp (1), .BR notmuch (1), .BR abook (1) -- cgit v1.2.3 From a3fc13e5ce54cd8d0e139e338ac75370e26c9184 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 23 Sep 2021 16:12:07 -0400 Subject: 465 now default instead of 587 --- README.md | 2 +- bin/mw | 6 +++--- mw.1 | 2 +- share/domains.csv | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 2aee255..a19170b 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ The mutt-wizard runs via the command `mw`. Once setup is complete, you'll use - `-i` -- IMAP server address - `-I` -- IMAP server port (otherwise assumed to be 993) - `-s` -- SMTP server address -- `-S` -- SMTP server port (otherwise assumed to be 587) +- `-S` -- SMTP server port (otherwise assumed to be 465) - `-m` -- Maximum number of emails to be kept offline. No maximum is default functionality. - `-x` -- Account password. You will be prompted for it otherwise. diff --git a/bin/mw b/bin/mw index 051bf54..8adb0b9 100755 --- a/bin/mw +++ b/bin/mw @@ -40,7 +40,7 @@ list() { getaccounts && [ -n "$accounts" ] && echo "$accounts" || exit 1 ;} prepmsmtp() { echo "account $fulladdr host $smtp -port ${sport:-587} +port ${sport:-465} from $fulladdr user $login passwordeval \"pass $fulladdr\" @@ -48,7 +48,7 @@ auth ${auth:-on} tls on tls_trust_file $sslcert logfile $msmtplog -$tlsline +${tlsline:-tls_starttls off} " >> "$msmtprc" } @@ -193,7 +193,7 @@ askinfo() { \ read -r imap [ -z "$smtp" ] && echo "Give your email server's SMTP address (excluding the port number):" && read -r smtp - [ "$sport" = 465 ] && tlsline="tls_starttls off" + [ "$sport" = 587 ] && tlsline="# tls_starttls" [ -z "$realname" ] && realname="${fulladdr%%@*}" hostname="$(echo "$fulladdr" | cut -d @ -f 2)" login="${login:-$fulladdr}" diff --git a/mw.1 b/mw.1 index 26d9569..a8c5c8e 100644 --- a/mw.1 +++ b/mw.1 @@ -63,7 +63,7 @@ IMAP/POP server port (assumed to be 993 for IMAP and 995 for POP if not specifie SMTP server address .TP .B -S -SMTP server port (assumed to be 587 if not specified) +SMTP server port (assumed to be 465 if not specified) .TP .B -x Account password. You will be prompted for the password interactively if this option is not given. diff --git a/share/domains.csv b/share/domains.csv index e307b22..854d383 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -160,7 +160,7 @@ live.rhul.ac.uk,outlook.office365.com,993,smtp.office365.com,587 logorroici.org,mail.autistici.org,993,smtp.autistici.org,465 loves.dicksinhisan.us,mail.cock.li,993,mail.cock.li,587 loves.dicksinmyan.us,mail.cock.li,993,mail.cock.li,587 -lukesmith.xyz,mail.lukesmith.xyz,993,mail.lukesmith.xyz,587 +lukesmith.xyz,mail.lukesmith.xyz,993,mail.lukesmith.xyz,465 luther.edu,imap.gmail.com,993,smtp.gmail.com,587 mac.com,imap.mail.me.com,993,smtp.mail.me.com,587 mace.ac.in,imap.gmail.com,993,smtp.gmail.com,587 -- cgit v1.2.3 From 85c5d01dcd09058094a8a180c38751e88416b1f4 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Wed, 6 Oct 2021 22:51:30 -0400 Subject: mw -r to reorder account numbers --- README.md | 1 + bin/mw | 24 +++++++++++++++++++++++- mw.1 | 3 +++ 3 files changed, 27 insertions(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index a19170b..372aa02 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,7 @@ The mutt-wizard runs via the command `mw`. Once setup is complete, you'll use - `mw -D your@email.com` -- delete account settings without confirmation - `mw -t 30` -- toggle automatic mailsync to every 30 minutes - `mw -T` -- toggle mailsync without specifying minutes (default is 10) +- `mw -r` -- reorder account shortcut numbers - `pass edit mw-your@email.com` -- revise an account's password ### Options usable when adding an account diff --git a/bin/mw b/bin/mw index d39b0a6..5205a13 100755 --- a/bin/mw +++ b/bin/mw @@ -285,6 +285,7 @@ Main actions: -Y Sync mail for all accounts -t number Toggle automatic mailsync every minutes -T Toggle automatic mailsync + -r Reorder account numbers Options allowed with -a: -u Account login name if not full address @@ -307,8 +308,28 @@ To change an account's password, run \`pass edit your@email.com\`. EOF } -while getopts "fpPXlhodTYD:y:i:I:s:S:u:a:n:x:m:t:" o; do case "${o}" in +reorder(){ + tempfile="$(mktemp -u)" + trap 'rm -f $tempfile' HUP INT QUIT TERM PWR EXIT + echo "# Carefully reorder these accounts with the desired numbers." > "$tempfile" + sed -n " + / i[0-9] / s?\(.* i\|' "$tempfile" + ${EDITOR:-vim} "$tempfile" || exit 1 + default="$(sort -n "$tempfile" | head -n 1)" + default="${default#* }" + sed -ibu "/.* i[0-9] .*.muttrc/d" "$muttrc" 2>/dev/null; rm -f "$muttrc"bu + awk -v a="$accdir" -v d="$default" ' BEGIN { print "source "a"/"d".muttrc" } + { + print "macro index,pager i"$1" '\''source "a"/"$2".muttrc!;'\'' \"switch to "$2"\"" + } + ' "$tempfile" >> "$muttrc" + +} + +while getopts "rfpPXlhodTYD:y:i:I:s:S:u:a:n:x:m:t:" o; do case "${o}" in l) setact list || exit 1 ;; + r) setact reorder || exit 1 ;; d) setact delete || exit 1 ;; D) setact delete || exit 1 ; fulladdr="$OPTARG" ;; y) setact sync || exit 1 ; fulladdr="$OPTARG" ;; @@ -347,5 +368,6 @@ case "$action" in delete) delete ;; sync) mailsync $fulladdr ;; toggle) togglecron ;; + reorder) reorder ;; *) mwinfo; exit 1 ;; esac diff --git a/mw.1 b/mw.1 index a8c5c8e..4bdb383 100644 --- a/mw.1 +++ b/mw.1 @@ -41,6 +41,9 @@ toggle a cronjob that syncs your mail every 15 minutes (or any other number unde .TP .B -T toggle a cronjob without specifying minutes between sync +.TP +.B -r +reorder account shortcut numbers .SH OPTIONS FOR ADDING ACCOUNTS These can be specified on the command line, otherwise, you will be prompted for what is necessary. mutt-wizard knows the IMAP/SMTP server information for most email providers, so specifying them is usually redundant. .TP -- cgit v1.2.3 From aba07e26f83da9055c16255ace3836f4bfba665e Mon Sep 17 00:00:00 2001 From: 187Qrly <56300140+187Qrly@users.noreply.github.com> Date: Sat, 1 Jan 2022 15:53:33 +0100 Subject: Make gentoo users aware that they need the "sasl" for the neomutt package. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index 372aa02..ddf6f8b 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Specifically, this wizard: #### Dependencies -- `neomutt` - the email client. +- `neomutt` - the email client. (If you are using Gentoo GNU/Linux, you will need the `sasl` use flag to be enabled) - `curl` - tests connections (required at install). - `isync` - downloads and syncs the mail (required if storing IMAP mail locally). - `msmtp` - sends the email. -- cgit v1.2.3 From 65af1f047e672e2c5d42d457d891043bb407476d Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Tue, 29 Mar 2022 09:23:15 -0400 Subject: less secure fix --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index 372aa02..b46408c 100644 --- a/README.md +++ b/README.md @@ -199,7 +199,7 @@ See Luke's website [here](https://lukesmith.xyz). Email him at - Gmail accounts need to create an [App Password](https://support.google.com/accounts/answer/185833?hl=en) to - use with _**less secure**_ applications. This password is single-use (i.e. + use with "less secure" applications. This password is single-use (i.e. for setup) and will be stored and encrypted locally. Enabling third-party applications requires turning off two-factor authentication and this will circumvent that. You might also need to manually "Enable IMAP" in the -- cgit v1.2.3 From e1d47ea4830a41220e0a9754ad61bd71bcd81d51 Mon Sep 17 00:00:00 2001 From: rl Date: Fri, 13 May 2022 17:40:35 +0300 Subject: added encryption shortcut in neomutt interface description --- README.md | 1 + 1 file changed, 1 insertion(+) (limited to 'README.md') diff --git a/README.md b/README.md index 7626e4d..479870f 100644 --- a/README.md +++ b/README.md @@ -127,6 +127,7 @@ To give you an example of the interface, here's an idea: - `?` - see all keyboard shortcuts - `ctrl-j`/`ctrl-k` - move up and down in sidebar, `ctrl-o` opens mailbox. - `ctrl-b` - open a menu to select a URL you want to open in your browser. +- `p` - before sending mail choose to encrypt/sign your message ## Additional functionality -- cgit v1.2.3 From 162441dde07cf9c811085f3dbb7fee2ce4fa3522 Mon Sep 17 00:00:00 2001 From: rickylinden <59360547+rickylinden@users.noreply.github.com> Date: Fri, 13 May 2022 17:45:43 +0300 Subject: Update README.md Clearer description of encryption shortcut. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index 479870f..b634fc7 100644 --- a/README.md +++ b/README.md @@ -127,7 +127,7 @@ To give you an example of the interface, here's an idea: - `?` - see all keyboard shortcuts - `ctrl-j`/`ctrl-k` - move up and down in sidebar, `ctrl-o` opens mailbox. - `ctrl-b` - open a menu to select a URL you want to open in your browser. -- `p` - before sending mail choose to encrypt/sign your message +- `p` - encrypt/sign your message (in compose view, before sending the email). ## Additional functionality -- 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 'README.md') 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 2aae3860a2531c872ac69285da2b52801b73e864 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 1 Jul 2022 18:30:29 -0400 Subject: rm paypal crap, replace with xmr/btc. add website. --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 90243b6..9ec4f31 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # mutt-wizard +https://muttwizard.com/ + Get this great stuff without effort: - A full-featured and autoconfigured email client on the terminal with neomutt @@ -176,10 +178,9 @@ To give you an example of the interface, here's an idea: errors. - Open a PR to add new server information into `domains.csv` so their users can more easily use mutt-wizard. -- If nothing else, [Donate!](https://paypal.me/LukeMSmith) - -See Luke's website [here](https://lukesmith.xyz). Email him at -[luke@lukesmith.xyz](mailto:luke@lukesmith.xyz). +- If nothing else, donate: + - XMR: `8AzeWXhJvYJ1VeENHcNXCR1dLMgDALreZ1BdooZVjRKndv6myr3t1ue6C4ML2an5fWSpcP1sTDA9nKUMevkukDXG6chRjNv` + - BTC: `bc1qacqfp36ffv9mafechmvk8f6r8qy4tual6rcm9p` ## Details for Tinkerers -- cgit v1.2.3 From 3844aa140428d2e278b3848ad4785a90bf104f33 Mon Sep 17 00:00:00 2001 From: i-c-u-p <96894903+i-c-u-p@users.noreply.github.com> Date: Fri, 8 Jul 2022 02:51:11 -0500 Subject: put keyboard shortcuts in tag --- README.md | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 9ec4f31..7904bb5 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ A user of Arch-based distros can also install the current mutt-wizard release fr - `notmuch` - index and search mail. Install it and run `notmuch setup`, tell it that your mail is in `~/.local/share/mail/` (although `mw` will do this automatically if you haven't set notmuch up before). You can run it in mutt - with `ctrl-f`. Run `notmuch new` to process new mail. + with ctrl-f. Run `notmuch new` to process new mail. - `abook` - a terminal-based address book. Pressing tab while typing an address to send mail to will suggest contacts that are in your abook. - `urlview` - outputs urls in mail to browser. @@ -110,25 +110,25 @@ The mutt-wizard runs via the command `mw`. Once setup is complete, you'll use To give you an example of the interface, here's an idea: -- `m` - send mail (uses your default `$EDITOR` to write) -- `j`/`k` and `d`/`u` - vim-like bindings to go down and up (or `d`/`u` to go +- m - send mail (uses your default `$EDITOR` to write) +- j/k and d/u - vim-like bindings to go down and up (or d/u to go down/up a page). -- `l` - open mail, or attachment page or attachment -- `h` - the opposite of `l` -- `r`/`R` - reply/reply all to highlighted mail -- `s` - save selected mail or selected attachment -- `gs`,`gi`,`ga`,`gd`,`gS` - Press `g` followed by another letter to change - mailbox: `s`ent, `i`nbox, `a`rchive, `d`rafts, `S`pam, etc. -- `M` and `C` - For `M`ove and `C`opy: follow them with one of the mailbox - letters above, i.e. `MS` means "move to Spam". -- `i#` - Press `i` followed by a number 1-9 to go to a different account. If you +- l - open mail, or attachment page or attachment +- h - the opposite of l +- r/R - reply/reply all to highlighted mail +- s - save selected mail or selected attachment +- gs,gi,ga,gd,gS - Press g followed by another letter to change + mailbox: sent, inbox, archive, drafts, Spam, etc. +- M and C - For Move and Copy: follow them with one of the mailbox + letters above, i.e. MS means "move to Spam". +- i# - Press i followed by a number 1-9 to go to a different account. If you add 9 accounts via mutt-wizard, they will each be assigned a number. -- `a` to add address/person to abook and `Tab` while typing address to complete +- a to add address/person to abook and Tab while typing address to complete one from abook. -- `?` - see all keyboard shortcuts -- `ctrl-j`/`ctrl-k` - move up and down in sidebar, `ctrl-o` opens mailbox. -- `ctrl-b` - open a menu to select a URL you want to open in your browser. -- `p` - encrypt/sign your message (in compose view, before sending the email). +- ? - see all keyboard shortcuts +- ctrl-j/ctrl-k - move up and down in sidebar, ctrl-o opens mailbox. +- ctrl-b - open a menu to select a URL you want to open in your browser. +- p - encrypt/sign your message (in compose view, before sending the email). ## Additional functionality @@ -139,7 +139,7 @@ To give you an example of the interface, here's an idea: - `notmuch` - Index and search mail. Install it and run `notmuch setup`, tell it that your mail is in `~/.local/share/mail/` (although `mw` will do this automatically if you haven't set notmuch up before). You can run it in mutt - with `ctrl-f`. Run `notmuch new` to process new mail. + with ctrl-f. Run `notmuch new` to process new mail. - `abook` - A terminal-based address book. Pressing tab while typing an address to send mail to will suggest contacts that are in your abook. - `urlview` - Outputs URLs in an email to your browser. -- cgit v1.2.3