My Mail Setup
Fleeting1 Introduction
This document will try to show my current email setup.
2 A picture is better than a thousand words
Or something like that:
(src)
3 Decomposition of emails tools
On the contrary to “all-in-one” tools such as Thunderbird, I prefer to use one tool for each need.
I know only two ways to tackles emails: connect to a server and deal with them through some kind of web interface or get a local copy of the emails to use your own tools. The later gives you more freedom on how to filter, and index the emails, the former solution is lighter to use. I use the local copy solution.
Those are the tools I use for each use case associated to emails.
- to synchronise the emails with a local maildir copy: offlineimap
- to index emails (so that they can be found later): notmuch
- to read emails: emacs + notmuch
- to compose emails: emacs + notmuch
- to send emails: msmtp
- to encrypt emails: emacs + message-mode
First, I will try to describe the installation and configuration of all those tools, then, I will describe how I use the tool to fulfil each use case.
I won’t dig into the detail of each tool since their documentation is quite well done. I will only provide the minimum information to make them work together.
4 Offlineimap
The first tool of the chain, offlineimap allows you to keep synchronised a local Maildir folder with an IMAP account.
The configuration of offlineimap is made of:
- local repositories: local maildir folders
- remote repositories: remote IMAP accounts
- accounts: link between two repositories
I think that you could have in sync two local maildir folders or two IMAP repositories by linking them with an account, but I never tried this.
You generally start by describing the general information
[general]
# the name of the accounts
accounts = konubinix
# a custom python file that links to functions you may use later
pythonfile = ${KONIX_PERSO_DIR}/offlineimap.py
Then you describe each account separately. In my case, it generally contains no more than the names of the two repositories to keep in sync:
[Account konubinix]
localrepository = LocalKonubinix
remoterepository = RemoteKonubinix
# the default backend stores the sync information in a plain text file. It is much slower than the sqlite backend
status_backend = sqlite
Of course, the next step is to describe the two repositories to sync. In my situation, I use a gmail account:
[Repository LocalKonubinix]
type = GmailMaildir
localfolders = ~/Mail/mail.konubinix
[Repository RemoteKonubinix]
type = Gmail
remoteusereval = get_username("konubinix@gmail.com")
remotepasseval = get_password("konubinix@gmail.com")
Note the use of custom made functions get_username and get_password to get the informationa oO
5 notmuch
Given the maildir folder synchronised by offlineimap, you’ll want to index them.
Fortunately, the notmuch software does not much more than that.
You only need to follow the installation instructions available in their website.
6 msmtp
msmtp is a smtp client. Generally, people use local smtp server to send emails. It is cumbersome to use such a solution without using the port 25 of your machine and then without needing to be root to configure the software. I dislike the idea of being root to configure my emails and all email providers that I know of already provide a smtp server to be connected to.
Once again, the documentation is quite clear and is quite server dependent.
My konubinix account looks like that
account konu
tls on
tls_certcheck off
auth on
host smtp.gmail.com
port 587
from konubinix@gmail.com
user konubinix@gmail.com
passwordeval assword_dump_clear_password.sh konubinix@gmail.com@google && echo
Note the last line