Refactor multi-use email functions