Messages

Client : mutt

Sync : offlineimap, isync

Search : notmuch

Contacts

Client : goobook

~/.pim/markferry.net/goobookrc

[DEFAULT]
# If not given here, email and password is taken from .netrc using
# machine google.com
email: blah@markferry.net
password: "My obvious password"
# or if you want to get the password from a commmand:
;passwordeval: gpg --batch -d ~/.mutt/pw.gpg
# The following are optional, defaults are shown
cache_filename: ~/.pim/markferry.net/goobook_cache
;cache_expiry_hours: 24
;filter_groupless_contacts: yes

Offline

Mutt IMAP isn't available offline. Configure offlineimap mbsync and notmuch.

mbsync / isync

https://wiki.archlinux.org/index.php/Isync

(%i is the subdirectory of the user home %h - required to support multiple separate mail accounts.)

[Unit]
Description=Mailbox synchronization service

[Service]
Type=oneshot
ExecStart=/usr/bin/mbsync -c %h/%i/config/isync/mbsyncrc -V -a
# a script to classify messages (optional)
ExecStartPost=%h/%i/config/notmuch-hook.sh

Sync flags when local flags are changed by notmuch by watching the notmuch xapian directory.

~/.config/systemd/user/mbsync@.path

[Path]
PathChanged=%h/%i/mail/.notmuch/xapian

[Install]
WantedBy=multi-user.target

offlineimap

~/.offlineimaprc example:

[general]
accounts = markferry # comma separated
maxsyncaccounts = 3
pythonfile = ~/.auth.py # see below

[Account markferry]
localrepository = markferry_Local
remoterepository = markferry_Remote
status_backend = sqlite
autorefresh = 5
quick = 15

[Repository markferry_Local]
type = Maildir
localfolders = ~/mail
keepalive = 180
holdconnectionopen = yes

[Repository markferry_Remote]
maxconnections = 1
type = Gmail
#cert_fingerprint = 85dd311c4a1dbcda6fb53e46004386861844ed2e  # disable explicit cert
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
remoteuser = blah@markferry.net
remotepasseval = auth['blah@markferry.net']
realdelete = no
folderfilter = lambda foldername: foldername not in ['[Google Mail]/All Mail', '[Google Mail]/Spam']

.auth.py

A little python dictionary of credentials to isolate it from the rest of the (version-controlled) configs

~/.auth.py:

auth = dict()
auth['blah@markferry.net'] = 'My obvious password'

offlineimap-watchdog

Adapted for bash from the offlineimap FAQ

#!/bin/sh
# remove any old instances of this shell script or offlineimap
for pid in $(pgrep offlineimap)
do
    if  [ $pid -ne $$ ]
    then
        kill $pid
        echo killed old process: $pid
    fi
done

# wait for compiz (or whatever) to start and setup wifi
#sleep 20
# If offlineimap exits, restart it
while ((true))
do
    ( exec /usr/bin/offlineimap -u quiet )
    sleep 60 # prevents extended failure condition
done

Links