imapbase: moving networking out of the session