I wrote a small library in golang that implements barely enough IMAP to read unseen mail, that you can find here. It contains an example program that fetches all mails and prints the plain text to stdout.
I found the existing IMAP libraries too confusing to use - but having seen the RFCs concerning IMAP, that’s hardly the implementers’ fault. My stuff implements only the tiniest fraction of what IMAP encompasses. The standard is waaaay to big for my taste.