writing send_email function