function def change with array param to get emails