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



--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to