refactored to use a new type for passing email addresses to Smail functions, as well as better safety checks