Topic/add email support

(built on top of branch topic/misc_refactoring, should be reviewed/merged after that branch)