Revert changes to IMAP sessions.
* Revert commit 22b05c3246ed8ee4076faa417b212832646a3be5.
* Revert commit 35d29ed4b086a7287b7b46f8fa6da40e0dcb24f3.
* Revert commit db2671bfc9c85e917b6bbfbf4887f734944af22e.
* Revert commit af5702759cef47567796c879ae60367a47fc59c9.