Question: I'm looking for an IMAP client library or parser that can support asynchronous I/O. The end goal being I could have dedicated thread(s) do socket I/O (via a poll() loop or similar) and could send data to waiting clients/parsers, as it becomes available. All of the code/libraries I've seen to date (java.mail, Python's imaplib, Thunderbird's C++ IMAP client, many random ones in C, C++) seem to follow the traditional blocking, one-thread-per-socket approach, which won't work for me.

My ideal client or library would behave much like <https://github.com/ry/http-parser> in that I/O behavior would not be dictated by the IMAP bits. Instead, the IMAP library would deal with buffers/strings and the caller would manage I/O.

The only possibility I've seen so far is libcurl. But, I'm not sure if the API will work and want to look at other possibilities before going too far down that road or inventing my own solution.

I'm open to considering libraries in any programming language.

Answer: 
Twisted (<http://twistedmatrix.com/>) has an asynchronous IMAP4 client: twisted.mail.imap4.IMAP4Client

People sometimes say that this protocol is difficult to implement, so implementation quality may be an issue. The defunct Chandler project used the twisted IMAP4 client, and its source code contains the comment "This functionality will be enhanced to be a more robust IMAP client in the near future".
I've had great results with node.js for this kind of thing. If listening to a lot of open sockets you'll need to tweak some linux settings to increase limits for the number of open file discriptors but it works great.