Add mail config - mutt & mbsync

This commit is contained in:
George Rawlinson 2016-11-07 15:27:14 +13:00
parent 567d1f7108
commit 362035681b
16 changed files with 330 additions and 3 deletions

View file

@ -3,6 +3,7 @@
```
git > global git config & aliases
lftp > sftp management
mail > mail config - mutt/mbsync
mpd > music player daemon config
ncmpcpp > ncurses mpc++ ui/colour settings & playlists
npm > npm configuration (ha ha)
@ -16,7 +17,7 @@ weechat > irc client ui/colour configuration
zsh > shell, aliases and cool stuff
```
`git clone git@github.com:grawlinson/dotfiles.git ~/.dotfiles`
`git clone https://github.com/grawlinson/dotfiles.git ~/.dotfiles`
Clone repository, then setup as desired.

View file

@ -9,7 +9,7 @@
* ownCloud client
* KeepassX2
* PulseAudio+pavucontrol
* Fonts (infinality-bundle ibfonts-meta-extended)
* Fonts (ttf-dejavu, noto-fonts, powerline-fonts)
* LaTeX (texlive-most)
## Browsers
@ -43,6 +43,7 @@
## Terminal
* termite
* weechat
* zsh
* screenfetch+scrot
@ -51,5 +52,8 @@
* lftp
* nvim
* unzip
* rxvt-unicode
* tmux
* ncdu
* (neo)mutt
* notmuch
* isync (aka mbsync)

View file

@ -0,0 +1,19 @@
# clear previously defined mailboxes
#unmailboxes *
set mbox = "+gmail/Archive"
set postponed = "+gmail/Drafts"
set trash = "+gmail/Trash"
unset record # gmail automatically records outgoing emails
set realname = "George Rawlinson"
set from = "george@rawlinson.net.nz"
# smtp settings
set smtp_pass= `pass mail/george@rawlinson.net.nz`
set smtp_url=smtp://$from@smtp.gmail.com:587
# gmail specific macros
macro index A "<save-message>+gmail/Archive<enter>" "move message to the archive"
macro index S "<save-message>+gmail/Spam<enter>" "mark message as spam"
macro index D "<save-message>+gmail/Trash<enter>" "move message to the trash"

View file

@ -0,0 +1,19 @@
# clear previously defined mailboxes
#unmailboxes *
set mbox = "+nullpointer/Archive"
set postponed = "+nullpointer/Drafts"
set trash = "+nullpointer/Trash"
set record = $XDG_DATA_HOME/mutt/record/sent
set realname = "George Rawlinson"
set from = "george@nullpointer.io"
# smtp settings
set smtp_pass = `pass mail/george@nullpointer.io`
set smtp_url=smtp://$from@mail.gandi.net:587
# nullpointer specific macros
macro index A "<save-message>+nullpointer/Archive<enter>" "move message to the archive"
macro index S "<save-message>+nullpointer/Spam<enter>" "mark message as spam"
macro index D "<save-message>+nullpointer/Trash<enter>" "move message to the trash"

View file

@ -0,0 +1,9 @@
# sidebar
bind index,pager \Ck sidebar-prev # select previous folder
bind index,pager \Cj sidebar-next # select next folder
bind index,pager \Co sidebar-open # open selected folder
bind index,pager B sidebar-toggle-visible # toggle sidebar
# message - todo
#bind index,pager k previous-line
#bind index,pager j next-line

38
mail/.config/mutt/colours Normal file
View file

@ -0,0 +1,38 @@
# sidebar colours
color sidebar_new blue black # mailboxes containing new mail
color sidebar_highlight black green # cursor to select mailbox
color sidebar_indicator black blue # current open mailbox
color sidebar_divider blue black # divider between sidebar/index
# general ui
color status blue black # colour for status line
color indicator black blue # currently selected message
color tree cyan default # arrow in threads
# mail colours
color index magenta black ~N # new messages
color index yellow black ~O # old messages
color index red black ~D # to-be-deleted
color index yellow black ~P # self-mail
# index
color index_flags red black '~N' # new messages
color index_flags red black '~O' # old messages
color index_flags yellow black '~P' # self-mail
color index_flags blue black '~Q' # messages replied to
color index_author default black '.*' # author colour
color index_date green default # date colour
color index_label default brightgreen # ???
# quoting depths
color quoted green default
color quoted1 green default
color quoted2 blue default
color quoted3 blue default
# urls
color body yellow black "(https|http|ftp|news|telnet|finger)://[^ \"\t\r\n]*"
# email addresses
color body yellow black [\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+
color body yellow black "mailto:[-a-z_0-9.]+@[-a-z_0-9.]+"

5
mail/.config/mutt/hooks Normal file
View file

@ -0,0 +1,5 @@
# folder hooks for different accounts
folder-hook gmail/* source ~/.config/mutt/accounts/gmail
folder-hook nullpointer/* source ~/.config/mutt/accounts/nullpointer
source ~/.config/mutt/accounts/gmail # default account

35
mail/.config/mutt/layout Normal file
View file

@ -0,0 +1,35 @@
# sidebar
set sidebar_visible # show sidebar
set sidebar_divider_char = "│" # divider between sidebar + index
set sidebar_width = 22 # sidebar width
set sidebar_format = "%B%?F? [%F]?%* %?N?%N?" # display folder name + unread count
# status bar
set status_chars = " *%A"
set status_format = "───[ Folder: %f ]───[%m messages%?n? (%n new)?%?d? (%d to delete)?%?t? (%t tagged)? ]───%>─%?p?( %p postponed )?───"
# email composition
ignore * # ignore all headers
unhdr_order *
unignore from: to: cc: date: subject: # show only from/to/cc/date/subject
hdr_order from: to: cc: date: subject:
# pager
set pager_context = 5 # lines of context in pager
set pager_index_lines = 10 # lines of mailbox shown in pager
set pager_stop # don't go to next message at bottom of pager
set smart_wrap # attempt to wrap messages in pager
set tilde # vim-like end of msg
unset markers # no line-wrap markers
alternative_order text/plain text/enriched text/html # display preference in order
# index
set date_format = "%y-%m-%d %H:%M" # YY-MM-DD HH:SS
set index_format = "[%Z] %D %-20.20F %s" # [message status flags] date author_name subject
set sort = threads # sort threaded mails
set strict_threads # don't define threads only by subject
set sort_aux = reverse-last-date-received # most recent mails at top
set sort_browser = reverse-date # ?
set uncollapse_jump # don't collapse on an unread message
#set sort_re # thread based on regex
#set reply_regexp = "^(([Rr][Ee]?(\[[0-9]+\])?: *)?(\[[^]]+\] *)?)*"

1
mail/.config/mutt/macros Normal file
View file

@ -0,0 +1 @@
# todo - switch account macros + tag behaviour (A/S/T)

View file

@ -0,0 +1,12 @@
mailboxes = +gmail/INBOX \
+gmail/Archive \
+gmail/Drafts \
+gmail/Sent \
+gmail/Spam \
+gmail/Trash \
+nullpointer/INBOX \
+nullpointer/Archive \
+nullpointer/Drafts \
+nullpointer/Sent \
+nullpointer/Spam \
+nullpointer/Trash

View file

@ -0,0 +1,2 @@
# pdf documents
application/pdf; okular %s;

38
mail/.config/mutt/muttrc Normal file
View file

@ -0,0 +1,38 @@
# conform to XDG base directory specification
set header_cache = $XDG_CACHE_HOME/mutt/headers
set message_cachedir = $XDG_DATA_HOME/mutt/messages
set mailcap_path = $XDG_CONFIG_HOME/mutt/mailcap
set record = $XDG_DATA_HOME/mutt/record/sent
set tmpdir = $XDG_RUNTIME_DIR
set certificate_file = $XDG_DATA_HOME/mutt/certificates
# i like having a clean uncluttered $HOME, sue me
# general
set mail_check = 0 # mbsync used for mail synchronisation
set timeout = 5 # wait 5s for user input
set sleep_time = 0 # disable pausing
set beep_new # beep when new mail received
# mailbox
set mbox_type = Maildir # mailbox format
set folder = ~/.mail # mailbox storage directory
set spoolfile = "+gmail/INBOX" # default mailbox
# ssl configuration
set ssl_starttls # use STARTTLS if not set
set ssl_force_tls # force TLS negotation
# composing configuration
set editor = "nvim +/^$ +nohlsearch" # place cursor after headers + turn off search highlighting
set edit_headers # enable header editing when composing
set mime_forward = ask-no # ask if fwd msg as attachments
# grab rest of the config
source ~/.config/mutt/colours
source ~/.config/mutt/mailboxes
source ~/.config/mutt/layout
source ~/.config/mutt/bindings
source ~/.config/mutt/macros
source ~/.config/mutt/hooks
#set read_only # set read-only when messing around with settings

View file

@ -0,0 +1,9 @@
[Unit]
Description=Mailbox synchronization service for user %I
[Service]
Type=oneshot
ExecStart=/usr/bin/mbsync -Va
User=%i
StandardOutput=syslog
StandardError=syslog

View file

@ -0,0 +1,10 @@
[Unit]
Description=Mailbox synchronization timer
[Timer]
OnBootSec=5min
OnUnitActiveSec=5min
Unit=mbsync@%i.service
[Install]
WantedBy=timers.target

123
mail/.mbsyncrc Normal file
View file

@ -0,0 +1,123 @@
# global config - applied to all channels
Create Both
Expunge Both
SyncState *
# gmail
IMAPAccount gmail
Host imap.gmail.com
User george@rawlinson.net.nz
PassCmd "pass mail/george@rawlinson.net.nz" # get password from pass
AuthMechs LOGIN
SSLType IMAPS
CertificateFile /etc/ssl/certs/ca-certificates.crt
# remote storage
IMAPStore gmail-remote
Account gmail
# local storage
MaildirStore gmail-local
Path ~/.mail/gmail/ # must append slash to specify directory
Inbox ~/.mail/gmail/INBOX # place inbox inside mail dir
# folders
Channel gmail-inbox
Master :gmail-remote:INBOX
Slave :gmail-local:INBOX
Channel gmail-archive
Master :gmail-remote:"[Gmail]/All Mail"
Slave :gmail-local:Archive
Channel gmail-drafts
Master :gmail-remote:"[Gmail]/Drafts"
Slave :gmail-local:Drafts
Channel gmail-sent
Master :gmail-remote:"[Gmail]/Sent Mail"
Slave :gmail-local:Sent
Channel gmail-spam
Master :gmail-remote:"[Gmail]/Spam"
Slave :gmail-local:Spam
Channel gmail-trash
Master :gmail-remote:"[Gmail]/Bin"
Slave :gmail-local:Trash
# all folders except above
Channel gmail-folders
Master :gmail-remote:
Slave :gmail-local:
Patterns * ![Gmail]* !INBOX !Archive !Drafts !Sent !Spam !Trash
# group all channels, so they can be sync'd with one command `mbsync gmail`
Group gmail
Channel gmail-trash
Channel gmail-inbox
Channel gmail-archive
Channel gmail-drafts
Channel gmail-sent
Channel gmail-spam
Channel gmail-folders
# nullpointer
IMAPAccount nullpointer
Host mail.gandi.net
User george@nullpointer.io
PassCmd "pass mail/george@nullpointer.io" # get password from pass
AuthMechs LOGIN
SSLType IMAPS
CertificateFile /etc/ssl/certs/ca-certificates.crt
# remote storage
IMAPStore nullpointer-remote
Account nullpointer
# local storage
MaildirStore nullpointer-local
Path ~/.mail/nullpointer/ # must append slash to specify directory
Inbox ~/.mail/nullpointer/INBOX # place inbox inside mail dir
# folders
Channel nullpointer-inbox
Master :nullpointer-remote:INBOX
Slave :nullpointer-local:INBOX
Channel nullpointer-archive
Master :nullpointer-remote:Archive
Slave :nullpointer-local:Archive
Channel nullpointer-drafts
Master :nullpointer-remote:Drafts
Slave :nullpointer-local:Drafts
Channel nullpointer-sent
Master :nullpointer-remote:Sent
Slave :nullpointer-local:Sent
Channel nullpointer-spam
Master :nullpointer-remote:Spam
Slave :nullpointer-local:Spam
Channel nullpointer-trash
Master :nullpointer-remote:Trash
Slave :nullpointer-local:Trash
# all folders except above
Channel nullpointer-folders
Master :nullpointer-remote:
Slave :nullpointer-local:
Patterns * !INBOX !Archive !Drafts !Sent !Spam !Trash
# group all channels, so they can be sync'd with one command `mbsync nullpointer`
Group nullpointer
Channel nullpointer-trash
Channel nullpointer-inbox
Channel nullpointer-archive
Channel nullpointer-drafts
Channel nullpointer-sent
Channel nullpointer-spam
Channel nullpointer-folders

View file

@ -0,0 +1,2 @@
# conform to XDG base directory specification
alias mutt='mutt -F ~/.config/mutt/muttrc'