Ya está resuelto, aqui teneis el código:
Código Python:
Ver originaldef CatchAll ():
"""Catch all msg from the email Catch-all"""
host=''
user=''
pwd=''
mails = imaplib.IMAP4(host)
mails.login(user,pwd)
total=mails.select('INBOX')
for num in range(int(total[1][0])):
print 'HEADER:'
typ, msg_data = mails.fetch(num+1, '(BODY.PEEK[HEADER])')
for response_part in msg_data:
if isinstance(response_part, tuple):
print response_part[1]
print 'BODY TEXT:'
typ, msg_data = mails.fetch(num+1, '(BODY.PEEK[TEXT])')
for response_part in msg_data:
if isinstance(response_part, tuple):
print response_part[1]
mails.close()
mails.logout()