functions for sending emails and searching for users