Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29905

Is there a cheat-sheet for 'message_part' phrases I can use to fetch email data using Python's imaplib?

$
0
0
from imaplib import IMAP4_SSL

M = IMAP4_SSL(hostName, port)
M.login(emailID, emailPassword)
M.select('Inbox')

msgNums = '101,102' # Assume we need data from these 2 emails

# typ, messages = box.fetch(msgNums, '(RFC822)')
# typ, messages = box.fetch(msgNums, '(UID BODY[HEADER])')
typ, messages = box.fetch(msgNums, '(UID BODY[TEXT])')

I've only been able to find the three codes [(RFC822), (UID BODY[HEADER]), and (UID BODY[TEXT])]. Is there a full list of tags I can use?


Viewing all articles
Browse latest Browse all 29905

Trending Articles