Logic for email validation