Thanks a lot for your reply! I thought it would be simpler if the
problem was presented in a brief way. Unfortunately, not for this
case.
Here is the detail. Free Yahoo! mail accounts can be accsessed via
IMAP protocal, however, a non-standard shake hand code is needed
before log in [1]:
. This is what I'm now working for. I tried:
IMAP4.xatom('','ID ("GUID" "1")','',)
dest_srv.xatom('ID ("GUID" "1")')
, but I got error messages. Any hint please?
In general, it would be helpful to include the error-message(s)
you get. However, I tried it with a junk Yahoo account I set up:
from imaplib import IMAP4
i = IMAP4("imap.mail.yahoo.com")
USER = '(e-mail address removed)'
PASS = 'your secret goes here'
# per the Wikipedia page you gave
# the ID has to happen before login
i.xatom('ID ("GUID" "1")')
i.login(USER, PASS)
i.select()
typ, data = i.search(None, 'ALL')
for num in data[0].split():
typ, data = i.fetch(num, '(RFC822)')
message = data[0][1].splitlines()
subject = [line
for line in message
if line.lower().startswith('subject: ')
][0]
print num, subject
i.close()
i.logout()
and it worked.
-tkc