Here's a little IMAP client in Go. imap/ contains the Go package; imapsync/ contains a small command that runs some of the code. This hasn't been tested against anything but gmail's IMAP yet, and will likely eat your mail, etc.