Imap and pop proxy?

Can someone give me an example of how to do an IMAP and POP3 proxy in
nginx. What i need to do is send all requests for to one
server and all requests for to another. I have read the
examples on the wiki but I do not understand them. I have a working
HTTP and HTTPS install now and would like to further secure my servers.
Any help would be appreciated