refactor of imap platform, fixed mishandled promises and adjusted the fetching process. not 100% tested. issue #145