Various fixes and improvements to the Mail module