added support in getEmail to prefer Workplace or Application email.