fix send email function