-adding the code for emailing

Intermediate checkin. More code to be added.