changed send email function