Workflow and script will do. The email must be unique though which is not guaranteed for customers. Corporates may use a same generic email for different entities. You will get a result but might invoice a wrong entity if customer emails are not unique.