email function update 2