Revert "extract saveMail function" and children

This reverts commit c07f03e53c25e999a03aa7ca9b90fe6f70b03964.
begin making a proper library out of it