New Email management system.

This should fix #11 and #68. It requires a schema change found in sql/patch-emailtemplate.sql.