Internet RFC 1939 (http://www.ietf.org/rfc/rfc1939.txt) defines POP3, and RFC 2060 (http://www.ietf.org/rfc/rfc2060.txt) defines the IMAP4rev1 protocol.