added some changes for sending mail.