You are looking for an e-mail client library. Currently, there are 2 options (as mentioned here):
- node-imap (IMAP)
- n3 (POP3, experimental)
I never used them before, but usage is pretty straight forward (according to the docs). node-imap seems to be the more stable library and it has been tested against gmail. If IMAP is an option in your environment, i’d stick with node-imap.