apply function to email