finish send email function