Revert "Merge pull request #11869 from mcav/imap-parsing-bug-901926"

This reverts commit a7941018788645f658011b623068ef9904d7f1b4, reversing
changes made to 216961d4f3705ebc6e49a6a8d20fae82534cfeb2.