Rework Makefile

make sure the dependencies are correct, and check dependencies before
running tests
Add configuration keys for email-related settings