How to send a non-standard IMAP command?
Xianwen Chen
xianwen.chen at gmail.com
Thu Jun 24 18:07:53 EDT 2010
On Thu, Jun 24, 2010 at 2:25 PM, Tim Chase <python.list at 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 = 'yourusername at 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
--
Xianwen Chen
University of Tromsø
http://u.nu/9uubc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100624/164bd270/attachment-0001.html>
More information about the Python-list
mailing list