Extracted the logic for retrieving the email address.