minor refactoring of emailer utility