added send mail functinon (need to be tested)