gmail support

Mashup with my fog library. This fork works well with gmail, which is not the case of the forked class (at least, I did not succeed to make it work with gmail)