email function added 100% working but not as we wanted