Add example user script

Signed-off-by: Olivier Aubert <contact@olivieraubert.net>
Introduce a logmsg function
Implement -D (dump_db) option

Dump the whole database to stdout
Implement filter specification in dump mode

The user can specify subject=foo, from=NNN, to=NNN options
Delete trailing whitespace
Pretty print (indent) dump data
Implement dump_stats option
Use mongodb aggregate framework to compute min/max info