add email testing infrastructure and add test