| @@ -12,7 +12,6 @@ Specifically, this wizard: | |||||
| - Encrypts and locally stores your password for easy remote access, accessible only by your GPG key | - Encrypts and locally stores your password for easy remote access, accessible only by your GPG key | ||||
| - Handles as many as nine separate email accounts automatically | - Handles as many as nine separate email accounts automatically | ||||
| - Auto-creates bindings to switch between accounts or between mailboxes | - 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 | - 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. | - 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/). | 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 add` -- add a new email account | ||||
| - `mw ls` -- list existing accounts | - `mw ls` -- list existing accounts | ||||
| - `mw pass` -- revise an account's password | - `mw pass` -- revise an account's password | ||||
| - `mw delete` -- delete an added account | - `mw delete` -- delete an added account | ||||
| - `mw sync` -- sync all mail accounts and update notmuch database | |||||
| - `mw purge` -- delete all accounts and settings | - `mw purge` -- delete all accounts and settings | ||||
| - `mw cron` -- toggle/configure a cronjob to sync mail | |||||
| ## Dependencies | ## Dependencies | ||||
| @@ -47,10 +46,8 @@ There's a chance of errors if you use a slow-release distro like Ubuntu, Debian | |||||
| ### Optional | ### Optional | ||||
| - `lynx` - view HTML email in neomutt. | - `lynx` - view HTML email in neomutt. | ||||
| - `notmuch` - index and search mail. Install it and run `notmuch setup`, tell it that your mail is in `~/.local/share/mail/` (although `mw` will do this automatically if you haven't set notmuch up before). You can run it in mutt with `ctrl-f`. Run `notmuch new` to process new mail, although the included `mailsync` script does this for you. | |||||
| - `libnotify`/`libnotify-bin` - allows notifications when 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. | - `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). | - `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. | - `urlview` - outputs urls in mail to browser. | ||||
| @@ -97,7 +97,7 @@ bind index,pager g noop | |||||
| bind index,pager M noop | bind index,pager M noop | ||||
| bind index,pager C noop | bind index,pager C noop | ||||
| bind index gg first-entry | bind index gg first-entry | ||||
| macro index o \"<shell-escape>mailsync -V $title<enter>\" \"run mbsync to sync $title\" | |||||
| macro index o \"<shell-escape>mbsync -V $title<enter>\" \"run mbsync to sync $title\" | |||||
| unmailboxes * | unmailboxes * | ||||
| " | " | ||||
| else | else | ||||
| @@ -286,27 +286,6 @@ delete() { sed -ibu "/IMAPStore $title-remote$/,/# End profile/d" "$mbsyncrc" ; | |||||
| sed -ibu "/account $title/,/^\(\s*$\|account\)/d" "$msmtprc"; rm -f "$msmtprc"bu | sed -ibu "/account $title/,/^\(\s*$\|account\)/d" "$msmtprc"; rm -f "$msmtprc"bu | ||||
| } | } | ||||
| choosecron() { ! pgrep cron >/dev/null && echo "No cron manager running. Install/enable one and then select this option again." && return 1 | |||||
| if crontab -l | grep mailsync >/dev/null; then | |||||
| echo "Active mail sync cronjob detected. Do you want to remove it?" | |||||
| printf "\033[36m\t" | |||||
| read -r rmyn | |||||
| printf "\033[0m" | |||||
| echo "$rmyn" | grep -i "^y\(es\)*$" >/dev/null && crontab -l | sed '/mailsync/d' | crontab - >/dev/null && echo "Mail sync turned off." | |||||
| else | |||||
| echo "How many minutes between each mail sync?" | |||||
| printf "\033[36m\t" | |||||
| read -r minnum | |||||
| printf "\033[0m" | |||||
| while ! echo "$minnum" | grep "^[0-9]\+$" >/dev/null; do | |||||
| printf "That doesn't look like a number. How many minutes between each mail sync?\\n\033[36m\t" | |||||
| read -r minnum | |||||
| printf "\033[0m" | |||||
| done | |||||
| (crontab -l; echo "*/$minnum * * * * $(type mailsync | cut -d' ' -f3) >/dev/null 2>&1") | crontab - >/dev/null && | |||||
| echo "Cronjob added. Mail will sync every $minnum minutes. Be sure you have your cron manager running." | |||||
| fi ;} | |||||
| asktype() { while : ; do | asktype() { while : ; do | ||||
| printf "Do you want to keep your mail for this account offline with mbsync? [yes/no]\\n\t" | printf "Do you want to keep your mail for this account offline with mbsync? [yes/no]\\n\t" | ||||
| read -r offnot | read -r offnot | ||||
| @@ -318,11 +297,17 @@ asktype() { while : ; do | |||||
| purge() { confirm "delete all account data" || exit | purge() { confirm "delete all account data" || exit | ||||
| rm -rf "$mbsyncrc" "$accdir" "$HOME/.config/msmtp" "$cachedir" | rm -rf "$mbsyncrc" "$accdir" "$HOME/.config/msmtp" "$cachedir" | ||||
| crontab -l | sed '/mailsync/d' | crontab - >/dev/null | |||||
| echo "All configs and account settings have been purged." | echo "All configs and account settings have been purged." | ||||
| sed -ibu "/\# mw-autogenerated/d" "$muttrc" ; rm -f "$muttrc"bu | sed -ibu "/\# mw-autogenerated/d" "$muttrc" ; rm -f "$muttrc"bu | ||||
| } | } | ||||
| syncwrapper() { mbsync -a & | |||||
| ( kill -46 "$(pidof "${STATUSBAR:-dwmblocks}")" >/dev/null 2>&1 ) 2>/dev/null | |||||
| wait | |||||
| ( kill -46 "$(pidof "${STATUSBAR:-dwmblocks}")" >/dev/null 2>&1 ) 2>/dev/null | |||||
| notmuch new | |||||
| } | |||||
| notmuchauto() { \ | notmuchauto() { \ | ||||
| [ -z "$NOTMUCH_CONFIG" ] && NOTMUCH_CONFIG="$HOME/.notmuch-config" | [ -z "$NOTMUCH_CONFIG" ] && NOTMUCH_CONFIG="$HOME/.notmuch-config" | ||||
| [ -f "$NOTMUCH_CONFIG" ] && return 0 | [ -f "$NOTMUCH_CONFIG" ] && return 0 | ||||
| @@ -349,8 +334,8 @@ case "$1" in | |||||
| add) asktype && askinfo && tryconnect && finalize || delete ;; | add) asktype && askinfo && tryconnect && finalize || delete ;; | ||||
| pass) pick "change the password of" && getpass ;; | pass) pick "change the password of" && getpass ;; | ||||
| delete) pick delete && confirm "delete the \`$title\` profile" && delete ;; | delete) pick delete && confirm "delete the \`$title\` profile" && delete ;; | ||||
| sync) syncwrapper ;; | |||||
| purge) purge ;; | purge) purge ;; | ||||
| cron) choosecron ;; | |||||
| *) cat << EOF | *) cat << EOF | ||||
| mw: mutt-wizard, auto-configure email accounts for mutt | mw: mutt-wizard, auto-configure email accounts for mutt | ||||
| including downloadable mail with \`isync\`. | including downloadable mail with \`isync\`. | ||||
| @@ -360,7 +345,7 @@ Allowed options: | |||||
| ls List configured accounts | ls List configured accounts | ||||
| delete Pick an account to delete | delete Pick an account to delete | ||||
| purge Delete all accounts and settings | purge Delete all accounts and settings | ||||
| cron Enable or disable an autosync via cronjob | |||||
| sync Syncs mail and updates notmuch database | |||||
| all else Print this message | all else Print this message | ||||
| NOTE: Once at least one account is added, you can run | NOTE: Once at least one account is added, you can run | ||||