Added more tests for mailbuild

Some additional tests and test refactoring