emails functionality added