cl_mail_proxy ~ # ulimit -n
4096
cl_mail_proxy ~ # cat /etc/security/limits.conf
@mail soft nofile 8098
@mail soft nproc 8098
@dovenull soft nofile 8098
@dovenull soft nproc 8098
* hard locks 8192
* hard nofile 8192
* soft locks 4096
* soft nofile 4096
#!/usr/bin/env python
import imaplib
M = imaplib.IMAP4('yourserver.com')
M.login('imapuser','imappass')
M.select()
typ, data = M.search(None, 'ALL')
for num in data[0].split():
typ, data = M.fetch(num, '(RFC822)')
print 'Message %s\n%s\n' % (num, data[0][1])
M.close()
M.logout()