slighly change how emailling works, plus write some tests.