TODO:
    [X] IMAP sync
    [X] SMTP send
    [X] neomutt account switching
    [X] organised sidebar
    [X] encrypted passwords
    [X] Notmuch search
    [X] Contacts
    [X] git this config
    [X] Parallel account sync
    [~] GPG setup
    [~] IMAP filtering
    [ ] Improve notmuch tab complete (multiple addresses)
    [ ] Spam filtering (if needed)
    [ ] Write blog post
    [ ] Monitor/fix folder-hook source path issue
    [ ] Add IMAP quota checking
    [ ] Reduce folder count
    [ ] Fix hotmail Inbox sync

New account checklist:
 - create password file .config/neomutt/<name>.pw.gpg
 - add to .mbsyncrc
 - add to .config/msmtp/config
 - add .config/neomutt/<name>.mail
 - add source <name> to .config/neomutt/neomuttrc
 - write fdm filters

Sane HTML viewing
    ~/.mailcap :
        text/html; unshare -n -r w3m -I %{charset} -T text/html; copiousoutput;
    To enable unshare without root:
        # https://blog.mister-muffin.de/2015/10/25/unshare-without-superuser-privileges/
        sudo sysctl -w kernel.unprivileged_userns_clone=1
    Or
        echo 1 | sudo tee /proc/sys/kernel/unprivileged_userns_clone > /dev/null
    Or more permanent
        echo 'kernel.unprivileged_userns_clone=1' > /etc/sysctl.d/userns.conf



/home/
    <user>/
        .config/
            neomutt/
                neomuttrc
                colors.rc
                gpg.rc
                sidebar.rc
                <account1>.mail
                <account1>.pw.gpg
                ...
            msmtp/
                config
        .mbsyncrc
/usr/
    local/
        bin/
            mailsync
/etc/
    systemd/
        user/
            mailsync.timer
            mailsync.service

systemctl enable --user mailsync.timer
systemctl enable --user mailsync.service
systemctl start --user mailsync.timer

Quota checking:
    https://askubuntu.com/questions/39674/can-i-speak-imap-and-review-my-actual-mail-quota
    http://www.faqs.org/rfcs/rfc2087.html
    https://docs.python.org/3.5/library/imaplib.html
    https://docs.python.org/3.5/library/ssl.html#ssl-security

    Or

    openssl s_client -connect <host>:<port> -starttls imap -crlf
        And then send commands WHEN SERVER IS READY (maybe use expect ?)

How to delete subfolder
    /!\ IMAP folder needs to be empty
    - remove mail from cur,new,tmp
    - sync folder content
    - remove ./cur/
    - sync folder deletion

Archive mail
    mlist <maildir> | mpick -t 'date < "2017-01-01"' | mrefile 2016