implementing the IMAP connection