Fixed and added integration test for the imap helper