Moved mail sent message to the sendMail function