Feature/new mail api

DO NOT MERGE
unfinished work.
pullreq only to be able to receive feedback.