Zkus sekci Inzerce a nabidni cenu. Pod 500 kc / zapocata hodina nema smysl se s tim ani zabyvat, ale.
mail = imaplib.IMAP4_SSL('imap.gmail.com')
mail.login('YOUREMAILADDRESS@gmail.com','YOUR PASSWORD HERE')
mail.select('inbox')
mail.list()
typ, data = mail.search(None, 'ALL')
for num in data[0].split():
typ, data = mail.fetch(num, '(RFC822)')
typ, data = mail.search(None, 'ALL')
ids = data[0]
id_list = ids.split()
if id_list:
latest_email_id = int( id_list[-1] )
for i in range( latest_email_id, latest_email_id-1, -1):
typ, data = mail.fetch( i, '(RFC822)')
for response_part in data:
if isinstance(response_part, tuple):
msg = email.message_from_string(response_part[1])
varSubject = msg['subject'] // to te zajima
// ------------
server = poplib.POP3_SSL(SERVER)
server.user(USER)
server.pass_(PASSWORD)
resp, items, octets = server.list() // po sem je to v podstate stejne
id, size = string.split(items[0])
resp, text, octets = server.retr(id)
text = string.join(text, "\n")
file = StringIO.StringIO(text)
message = rfc822.Message(file)
print(message['Subject']) // ten te zajima
Ja ti nevim, ale cely ten druhy kod by mel delat presne to, co potrebujes.
items[0] - neni tam cyklus, co prochazi vsechny zpravy, items. Cyklus tam dodas snadno, ne?
for item in items // zmena
id, size = string.split(item) // zmena
resp, text, octets = server.retr(id)
text = string.join(text, "\n")
file = StringIO.StringIO(text)
message = rfc822.Message(file)
print(message['Subject'])