Added code to send emails

Also fixed bug in NodeHandler which caused an error to be thrown if a
node in a session was freed while its housekeeping thread was still
running