| @@ -27,6 +27,8 @@ Note also that Gmail and some providers require you to enable sign-ins from thir | |||||
| ## Installation and Dependencies | ## 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.) | `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.) | ||||
| ``` | ``` | ||||
| @@ -0,0 +1,6 @@ | |||||
| [general] | |||||
| accounts = | |||||
| starttls = yes | |||||
| ssl = true | |||||
| pythonfile = ~/.config/mutt/credentials/imappwd.py | |||||
| @@ -7,7 +7,6 @@ remoterepository = $title-remote | |||||
| auth_mechanisms = LOGIN | auth_mechanisms = LOGIN | ||||
| type = $type | type = $type | ||||
| remoteuser = $login | remoteuser = $login | ||||
| sslcacerfile = /etc/ssl/cets/ca-certificates.crt | |||||
| remotepasseval = mailpasswd("$title") | remotepasseval = mailpasswd("$title") | ||||
| remotehost = $imap | remotehost = $imap | ||||
| remoteport = $iport | remoteport = $iport | ||||
| @@ -0,0 +1,19 @@ | |||||
| [Account $title] | |||||
| localrepository = $title-local | |||||
| remoterepository = $title-remote | |||||
| [Repository $title-remote] | |||||
| auth_mechanisms = LOGIN | |||||
| type = $type | |||||
| remoteuser = $login | |||||
| sslcacertfile = /usr/local/etc/openssl/cert.pem | |||||
| remotepasseval = mailpasswd("$title") | |||||
| remotehost = $imap | |||||
| remoteport = $iport | |||||
| folderfilter = lambda foldername: foldername not in ['[Gmail]/All Mail'] | |||||
| sslcacertfile = /usr/local/etc/openssl/cert.pem | |||||
| [Repository $title-local] | |||||
| type = Maildir | |||||
| localfolders = ~/.mail/$title | |||||
| @@ -7,8 +7,13 @@ | |||||
| # | # | ||||
| # I have this run as a cronjob every 5 minutes. | # I have this run as a cronjob every 5 minutes. | ||||
| # Check for internet connection. Exit script if none. | |||||
| ping -q -w 1 -c 1 `ip r | grep default | cut -d ' ' -f 3` >/dev/null || exit | |||||
| # Check for internet connection. Exit script if none. (timeout in mac is `-t`) | |||||
| if [ "$(uname)" == "Darwin" ] | |||||
| then | |||||
| ping -q -t 1 -c 1 `ip r | grep default | cut -d ' ' -f 3` >/dev/null || exit | |||||
| else | |||||
| ping -q -w 1 -c 1 `ip r | grep default | cut -d ' ' -f 3` >/dev/null || exit | |||||
| fi | |||||
| # Get current number of new mail, then begin sync. | # Get current number of new mail, then begin sync. | ||||
| ori=$(find ~/.mail -wholename '*/new/*' | grep -vi "spam\|trash\|junk" | wc -l) | ori=$(find ~/.mail -wholename '*/new/*' | grep -vi "spam\|trash\|junk" | wc -l) | ||||
| @@ -1,5 +1,12 @@ | |||||
| #!/bin/bash | #!/bin/bash | ||||
| if [[ "$(uname)" == "Darwin" ]] | |||||
| then | |||||
| os=".macos" | |||||
| else | |||||
| os="" | |||||
| fi | |||||
| muttdir="$HOME/.config/mutt/" | muttdir="$HOME/.config/mutt/" | ||||
| createMailboxes() { rm -f "$muttdir"autoconf/log | createMailboxes() { rm -f "$muttdir"autoconf/log | ||||
| @@ -179,8 +186,8 @@ addAccount() { | |||||
| mkdir -p "$muttdir"accounts/$title/cache/bodies | mkdir -p "$muttdir"accounts/$title/cache/bodies | ||||
| # Creating the offlineimaprc if it doesn't exist already. | # Creating the offlineimaprc if it doesn't exist already. | ||||
| if [ ! -f ~/.offlineimaprc ]; then cp "$muttdir"autoconf/offlineimap_header ~/.offlineimaprc; fi | |||||
| cat "$muttdir"autoconf/offlineimap_profile | sed -e "$replacement" >> ~/.offlineimaprc | |||||
| if [ ! -f ~/.offlineimaprc ]; then cp "$muttdir"autoconf/offlineimap_header"$os" ~/.offlineimaprc; fi | |||||
| cat "$muttdir"autoconf/offlineimap_profile"$os" | sed -e "$replacement" >> ~/.offlineimaprc | |||||
| mkdir -p ~/.mail/$title | mkdir -p ~/.mail/$title | ||||
| # Add the mutt profile. | # Add the mutt profile. | ||||
| @@ -189,7 +196,7 @@ addAccount() { | |||||
| echo "macro index,pager i$idnum '<sync-mailbox><enter-command>source "$muttdir"accounts/$title.muttrc<enter><change-folder>!<enter>'" >> "$muttdir"personal.muttrc | echo "macro index,pager i$idnum '<sync-mailbox><enter-command>source "$muttdir"accounts/$title.muttrc<enter><change-folder>!<enter>'" >> "$muttdir"personal.muttrc | ||||
| # Add to offlineimaprc sync list. | # Add to offlineimaprc sync list. | ||||
| sed -i "s/^accounts =.*[a-zA-Z]$/&, $title/g;s/^accounts =\s*$/accounts = $title/g" ~/.offlineimaprc | |||||
| sed -i.bu "s/^accounts =.*[a-zA-Z]$/&, $title/g;s/^accounts =\s*$/accounts = $title/g" ~/.offlineimaprc && rm ~/.offlineimaprc.bu | |||||
| # Makes account default if there is no default account. | # Makes account default if there is no default account. | ||||
| grep "$muttdir"personal.muttrc -e "^source .*accounts.*" >/dev/null && echo there || \ | grep "$muttdir"personal.muttrc -e "^source .*accounts.*" >/dev/null && echo there || \ | ||||
| @@ -7,7 +7,7 @@ source etc/muttcol | |||||
| source etc/aliases | source etc/aliases | ||||
| set sleep_time = 0 | set sleep_time = 0 | ||||
| set sort = 'reverse-date' | set sort = 'reverse-date' | ||||
| set editor = vim | |||||
| set editor = $EDITOR | |||||
| #set copy = no | #set copy = no | ||||
| set timeout = "5" | set timeout = "5" | ||||
| set mail_check = "10" | set mail_check = "10" | ||||