On Thu, Jun 24, 2010 at 2:25 PM, Tim Chase <span dir="ltr"><<a href="mailto:python.list@tim.thechases.com">python.list@tim.thechases.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">On 06/24/2010 04:47 AM, Xianwen Chen wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Thanks a lot for your reply! I thought it would be simpler if the<br>
problem was presented in a brief way. Unfortunately, not for this<br>
case.<br>
<br>
Here is the detail. Free Yahoo! mail accounts can be accsessed via<br>
IMAP protocal, however, a non-standard shake hand code is needed<br>
before log in [1]:<br>
<br>
ID ("GUID" "1")<br>
<br>
. This is what I'm now working for. I tried:<br>
<br>
IMAP4.xatom('','ID ("GUID" "1")','',)<br>
<br>
and<br>
<br>
dest_srv.xatom('ID ("GUID" "1")')<br>
<br>
, but I got error messages. Any hint please?<br>
</blockquote>
<br></div>
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:<br>
<br>
  from imaplib import IMAP4<br>
  i = IMAP4("<a href="http://imap.mail.yahoo.com" target="_blank">imap.mail.yahoo.com</a>")<br>
  USER = '<a href="mailto:yourusername@yahoo.com" target="_blank">yourusername@yahoo.com</a>'<br>
  PASS = 'your secret goes here'<br>
  # per the Wikipedia page you gave<br>
  # the ID has to happen before login<br>
  i.xatom('ID ("GUID" "1")')<br>
<br>
  i.login(USER, PASS)<br>
  i.select()<br>
  typ, data = i.search(None, 'ALL')<br>
  for num in data[0].split():<br>
    typ, data = i.fetch(num, '(RFC822)')<br>
    message = data[0][1].splitlines()<br>
    subject = [line<br>
      for line in message<br>
      if line.lower().startswith('subject: ')<br>
      ][0]<br>
    print num, subject<br>
  i.close()<br>
  i.logout()<br>
<br>
and it worked.<br>
<br>
-tkc<br>
<br>
<br>
<br>
</blockquote></div><br><br clear="all">Hi Tim,<br><br>The problem was the password. I was careless. Thanks for your advice. Next time I'll have error codes posted.<br><br>And thanks a lot for your constructive example!<br>
<br>I have a strange problem that<br><br>"M = imaplib.IMAP4_SSL(M_addr)<br>M.debug = 2"<br><br>doesn't work. No verbose output at all. Any hint please?<br><br>Best regards,<br><br>Xianwen<br><br><br>-- <br>Xianwen Chen<br>
University of Tromsø<br><a href="http://u.nu/9uubc">http://u.nu/9uubc</a><br><br>