email function complete