added funtionality to send emails and unit tests