On Jun 24, 2:25 pm, Tim Chase <python.l...@tim.thechases.com> wrote: > On 06/24/2010 04:47 AM, Xianwen Chen wrote: > > > > > 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]: > > > ID ("GUID" "1") > > > . This is what I'm now working for. I tried: > > > IMAP4.xatom('','ID ("GUID" "1")','',) > > > and > > > 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 = 'yourusern...@yahoo.com' > 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
Hi Tim, The problem was the password. I was careless. Thanks for your advice. Next time I'll have error codes posted. And thanks a lot for your constructive example! I have a strange problem that "M = imaplib.IMAP4_SSL(M_addr) M.debug = 2" doesn't work. No verbose output at all. Any hint please? Best regards, Xianwen -- http://mail.python.org/mailman/listinfo/python-list