Use the email module to parse the templates

In order to use the thing, I had to modify the way encoding is handle
when dealing with the editor files, although it shouldn't change
anything for the end user (and as a bonus, it should make the Python3
transition easier, we'll just have to remove the u'' markers)
Search for a local file before searching the template dir

Among other things, this allows for editing and sending easily git
patches via git format-patch