From fe85cb6835278ce804657a486629d0b2be7f34b5 Mon Sep 17 00:00:00 2001 From: ZethJack Date: Fri, 16 Mar 2018 07:26:58 +0000 Subject: [PATCH 1/6] Update offlineimap_profile Removed "sslcacerfile = /etc/ssl/cets/ca-certificates.crt" on line 10 - it was pointing to non-existant directory "cets" instead of "certs" - this setting is overwritten later with correct path therefore no errors would register. --- autoconf/offlineimap_profile | 1 - 1 file changed, 1 deletion(-) diff --git a/autoconf/offlineimap_profile b/autoconf/offlineimap_profile index 0711979..2277d6b 100644 --- a/autoconf/offlineimap_profile +++ b/autoconf/offlineimap_profile @@ -7,7 +7,6 @@ remoterepository = $title-remote auth_mechanisms = LOGIN type = $type remoteuser = $login -sslcacerfile = /etc/ssl/cets/ca-certificates.crt remotepasseval = mailpasswd("$title") remotehost = $imap remoteport = $iport From 8330175b037360e480fe0221c668ca297a862b2b Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 16 Mar 2018 12:10:16 -0700 Subject: [PATCH 2/6] mailbox detect now automatic on account add --- .gitignore | 1 + mutt-wizard.sh | 16 +++++++++++----- muttrc | 1 + 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 4aec69b..77ab643 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ accounts/ *.pyc personal.muttrc thunderbird/ +autoconf/log diff --git a/mutt-wizard.sh b/mutt-wizard.sh index 18ee806..9995ffa 100755 --- a/mutt-wizard.sh +++ b/mutt-wizard.sh @@ -2,6 +2,12 @@ muttdir="$HOME/.config/mutt/" +createMailboxes() { rm -f "$muttdir"autoconf/log + offlineimap --info -a $1 2&> "$muttdir"autoconf/log + for box in $(sed -n '/^Folderlist/,/^Folderlist/p' "$muttdir"autoconf/log | + grep "^ " | awk '{print $1}' | sed -e 's/\//./g') + do mkdir -p $HOME/.mail/$1/$box; echo mkdir -p $HOME/.mail/$1/$box; done ;} + chooseSync() { (crontab -l && testSync) || dialog --msgbox "No cronjob manager detected. Please install one and return to enable automatic mailsyncing" 10 60 ;} testSync() { (crontab -l | grep .config/mutt/etc/mailsync && removeSync) || addSync ;} @@ -189,12 +195,12 @@ addAccount() { grep "$muttdir"personal.muttrc -e "^source .*accounts.*" >/dev/null && echo there || \ echo "source ${muttdir}accounts/$title.muttrc" >> "$muttdir"personal.muttrc - dialog --title "Finalizing your account." --msgbox "The account \"$title\" has been added. Now to finalize installation, do the following: + dialog --title "Finalizing your account." --infobox "The account \"$title\" has been added. Now attempting to configure mail directories... - 1) Run offlineimap to start the sync. This will start your mail sync. - 2) After or while running offlineimap, choose the \"autodetect mailboxes\" option, which will finalize your config files based on the directory structure of the downloaded mailbox. - - After that, you will be able to open neomutt to your email account." 13 80 ;} + This may take several seconds..." 10 70 + createMailboxes $title || (clear && exit) + detectMailboxes $title + dialog --title "Account added." --msgbox "Your "$fulladdr" account has been added. To start the download of your mail, you can manually run \`offlineimap -a $title\` in a terminal. The first sync may take some time depending on the amount of your mail." 8 60 ;} # This is run when a user chooses to add an account. chooseAdd() { \ diff --git a/muttrc b/muttrc index 041198f..88ee9fa 100644 --- a/muttrc +++ b/muttrc @@ -19,6 +19,7 @@ set forward_format = "Fwd: %s" set markers = no set mark_old = no set mime_forward = yes +set smtp_authenticators = 'gssapi:login' auto_view text/html auto_view application/pdf alternative_order text/plain text/enriched text/html From 4abc05bfb55b012e5d4082423b0565b59f85a05c Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 16 Mar 2018 12:14:25 -0700 Subject: [PATCH 3/6] personal.muttrc remove fix --- mutt-wizard.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mutt-wizard.sh b/mutt-wizard.sh index 9995ffa..8bad868 100755 --- a/mutt-wizard.sh +++ b/mutt-wizard.sh @@ -112,7 +112,7 @@ removeAccount() { sed -ie " rm "$muttdir"accounts/$1.muttrc rm "$muttdir"credentials/$1.gpg rm -rf "$muttdir"accounts/$1 - sed -i '/$1.muttrc/d' "$muttdir"personal.muttrc ;} + sed -i "/$1.muttrc/d" "$muttdir"personal.muttrc ;} manual() { \ imap=$( dialog --inputbox "Insert the IMAP server for your email provider (excluding the port number)" 10 60 3>&1 1>&2 2>&3 3>&- ) From 0a4b4674a5a61ec7a227cee6aa69ad52c7f7acc8 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 16 Mar 2018 12:16:46 -0700 Subject: [PATCH 4/6] silly echo removed --- mutt-wizard.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mutt-wizard.sh b/mutt-wizard.sh index 7d8325a..5a1e001 100755 --- a/mutt-wizard.sh +++ b/mutt-wizard.sh @@ -13,7 +13,7 @@ createMailboxes() { rm -f "$muttdir"autoconf/log offlineimap --info -a $1 2&> "$muttdir"autoconf/log for box in $(sed -n '/^Folderlist/,/^Folderlist/p' "$muttdir"autoconf/log | grep "^ " | awk '{print $1}' | sed -e 's/\//./g') - do mkdir -p $HOME/.mail/$1/$box; echo mkdir -p $HOME/.mail/$1/$box; done ;} + do mkdir -p $HOME/.mail/$1/$box; done ;} chooseSync() { (crontab -l && testSync) || dialog --msgbox "No cronjob manager detected. Please install one and return to enable automatic mailsyncing" 10 60 ;} testSync() { (crontab -l | grep .config/mutt/etc/mailsync && removeSync) || addSync ;} From d50da7007088f6dc9a7c410d00a50dd17e8953bf Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 16 Mar 2018 12:31:38 -0700 Subject: [PATCH 5/6] readme updates --- README.md | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index e27d766..341ced8 100644 --- a/README.md +++ b/README.md @@ -27,8 +27,6 @@ Note also that Gmail and some providers require you to enable sign-ins from thir ## Installation and Dependencies -> **MacOS prerequisites** - Install `iproute2mac` and `mpv` ( brew install iproute2mac mpv ) - `dialog`, `neomutt` and `offlineimap` should be installed. You also need to have a GPG public/private key pair for the wizard to automatically store your passwords. The whole repo should be cloned to `~/.config/mutt/`. (If you have a previous mutt folder, you'll want to back it up or delete it first.) ``` @@ -37,13 +35,7 @@ git clone https://github.com/LukeSmithxyz/mutt-wizard.git ~/.config/mutt You will want to delete or rename your current `~/.offlineimaprc` as well, as although you can later modify the `~/.offlineimaprc` produced by the script, you must have no file there the first time you add your first account or the wizard will assume some settings are already set which aren't. -Just run `mutt-wizard.sh` for all the options, to install an account: - -* First, select the "Add an account" option and give the script your account information. -* Second, in a separate terminal, start your mail sync by running `offlineimap` or `offlineimap -a `. This will start downloading all your mail for offline access. -* Third, once your mailbox has started to download, reenter the script and select the "Auto-detect mailboxes" open. This will finalize the install and let you open up mutt to see your mail. - -Whenever you want to check for mail, just run the `offlineimap` command again. +Just run `mutt-wizard.sh` and choose to add an account. After you do so, you may run `offlineimap` to begin the mailsync, and you will be able to run neomutt and see your mail. ### Non-essential dependencies @@ -54,6 +46,7 @@ The automatically deployed configs will look for certain programs for certain ex + `notmuch` -- for mail searching and indexing set to `ctrl-f`. Be sure to run `notmuch setup`. Remember your mail is in `~/.mail/` when you configure notmuch. + `w3m` and/or `w3mimg` -- for viewing images. Like .pdfs, view in the attachments menu. + A cron manager if you want the autosync feature. ++ `iproute2mac` for Mac users who want the autosync feature. + `mpv` if you want the autosync feature to notify you with a ding on new mail. ### "Wait? The script asks for my passwords?" From 459ca7d5a0f9737dba5fb42315dac0237397c8fb Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 16 Mar 2018 12:34:46 -0700 Subject: [PATCH 6/6] interface tweaks --- README.md | 4 ++-- mutt-wizard.sh | 24 +++++++++++------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 341ced8..7d34042 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ The mutt-wizard is all of this in a simple ncurses menu. It's really just a litt The system takes an email and autodetect its server settings, generating a muttrc and offlineimaprc profile automatically. If it can't do so, it simply prompts you for these (which you can easily look up) and will put them all in the right places. You get: -+ Automatic configuration of mutt and offlineimap -+ Automatic encryption and safe storage of passwords which are used by mutt and offlineimap when necessary ++ Automatic configuration of mutt and offlineimap. ++ Automatic encryption and safe storage of passwords which are used by mutt and offlineimap when necessary. + Multiple account management in mutt: jump from account to account with the `i` prefix in mutt: `i1`: first email account, `i5`: fifth, etc. + Easy movement to mail folders in mutt: `gi`: go to inbox, `gs` to sent mail, `ga` to archive, `gS` to spam, `gd` to drafts, etc. + Some default controls and colors. This system is going to be integrated into my [public auto-rice script](https://larbs.xyz) so I want it to look pretty and be usable out the box. diff --git a/mutt-wizard.sh b/mutt-wizard.sh index 5a1e001..1fd21a8 100755 --- a/mutt-wizard.sh +++ b/mutt-wizard.sh @@ -228,15 +228,14 @@ wipe () { rm $HOME/.offlineimaprc while : ; do choice=$(dialog --title "Luke's mutt/offlineIMAP wizard" --nocancel \ - --menu "What would you like to do?" 16 45 8 \ + --menu "What would you like to do?" 14 45 7 \ 0 "List all email accounts configured." \ 1 "Add an email account." \ - 2 "Auto-detect mailboxes for an account." \ - 3 "Enable/disable autosync." \ - 4 "Change an account's password." \ - 5 "Remove an email account." \ - 6 "Remove all email accounts." \ - 7 "Exit this wizard." \ + 2 "Enable/disable autosync." \ + 3 "Change an account's password." \ + 4 "Remove an email account." \ + 5 "Remove all email accounts." \ + 6 "Exit this wizard." \ 3>&1 1>&2 2>&3 3>&1 ) case $choice in @@ -244,11 +243,10 @@ case $choice in $(grep ~/.offlineimaprc -e "^accounts =" | sed 's/accounts =//g') " 6 60;; 1) chooseAdd;; -2) detectWarning && chooseDetect ;; -3) chooseSync;; -4) inventory && for i in $userchoices; do changePassword $i ; done;; -5) inventory && for i in $userchoices; do removeAccount $i ; done;; -6) (dialog --defaultno --title "Wipe all custom neomutt/offlineIMAP settings?" --yesno "Would you like to wipe all of the mutt/offlineIMAP settings generated by the system?" 6 60 && wipe) ;; -7) clear && break ;; +2) chooseSync;; +3) inventory && for i in $userchoices; do changePassword $i ; done;; +4) inventory && for i in $userchoices; do removeAccount $i ; done;; +5) (dialog --defaultno --title "Wipe all custom neomutt/offlineIMAP settings?" --yesno "Would you like to wipe all of the mutt/offlineIMAP settings generated by the system?" 6 60 && wipe) ;; +6) clear && break ;; esac done