Simplify setting up email configuration during app boot-up.

Signed-off-by: crynobone <crynobone@gmail.com>
Cleanup code and update testcases.

Signed-off-by: crynobone <crynobone@gmail.com>