added send mail logic