factor out common handling, get email alerts going