email building and tests