Added email functionality to the spot indicated in the last commit and ironed out a few details in the implementation to make it all work.