Ver Mensaje Individual
  #3 (permalink)  
Antiguo 31/05/2010, 09:36
Avatar de Nekeniehl
Nekeniehl
 
Fecha de Ingreso: julio-2009
Ubicación: Berlin, Alemania / Granada, España
Mensajes: 132
Antigüedad: 14 años, 9 meses
Puntos: 6
Respuesta: [Sugerencia] Como recuperar mensajes de la bandeja de entrada.

Ya está resuelto, aqui teneis el código:
Código Python:
Ver original
  1. def CatchAll ():
  2.     """Catch all msg from the email Catch-all"""
  3.     host=''
  4.     user=''
  5.     pwd=''
  6.     mails = imaplib.IMAP4(host)
  7.     mails.login(user,pwd)
  8.  
  9.     total=mails.select('INBOX')
  10.    
  11.     for num in range(int(total[1][0])):
  12.         print 'HEADER:'
  13.         typ, msg_data = mails.fetch(num+1, '(BODY.PEEK[HEADER])')
  14.         for response_part in msg_data:
  15.             if isinstance(response_part, tuple):
  16.                 print response_part[1]
  17.  
  18.         print 'BODY TEXT:'
  19.         typ, msg_data = mails.fetch(num+1, '(BODY.PEEK[TEXT])')
  20.         for response_part in msg_data:
  21.             if isinstance(response_part, tuple):
  22.                 print response_part[1]
  23.  
  24.                    
  25.     mails.close()
  26.     mails.logout()
__________________
Antes de cambiar el mundo...dá tres vueltas por tu casa

Usa Google es tu amigo ;)