added code to send mail