tttm

git clone https://orangeshoelaces.net/git/tttm.git

/README

   1 tttm - mail retrieval agent.
   2 
   3 Fetches mail from IMAP4rev1 inbox and delivers each message via
   4 standard input to anohter program. Transfered mail gets expunged
   5 from server afterwards.
   6 
   7 See manual for details.
   8 
   9 Works on OpenBSD. Likely to behave just as fine on other BSDs,
  10 Linuxes and other POSIX-friendly operating systems.
  11 
  12 Needs a decent C compiler (uses some of C11 feats) with standard
  13 library.