简体   繁体   中英

Using Idle with Imap_tools and Yahoo

I am trying to test the idle functionality of imap_tools on my Yahoo mailbox. I have gone through the steps to allow third party apps, etc but I keep getting an error (included below).

I am using the example given on Github.

Is this an error in the library or does Yahoo not support idling?

from imap_tools import MailBox, A

# waiting for updates 60 sec, print unseen immediately if any update
with MailBox('imap.mail.yahoo.com').login('acc', 'pwd', 'INBOX') as mailbox:
    responses = mailbox.idle.wait(timeout=60)
    if responses:
        for msg in mailbox.fetch(A(seen=False)):
            print(msg.date, msg.subject)
    else:
        print('no updates in 60 sec')

Traceback:

Traceback (most recent call last):
  File "C:*****", line 11, in <module>
    mailbox.idle.start()
  File "C:*****", line 54, in start
    check_command_status((result, 'IDLE start'), MailboxTaggedResponseError, expected=None)
  File "C:*****", line 45, in check_command_status
    raise exception(command_result=command_result, expected=expected)
imap_tools.errors.MailboxTaggedResponseError: Response status "None" expected, but "b'FMAK3 BAD [CLIENTBUG] ID Command arguments invalid'" received. Data: IDLE start

Last time I checked, Yahoo didn't support IMAP IDLE. Make sure you check the CAPABILITIES response before using extended features.

It appears the server has interpreted the IDLE command as the ID command, lending further credence that it does not support it.

From previous experience, Yahoo really does not want people using long lived connections: they want people to log in, fetch their new email, and log off. You will have to poll with Yahoo. They will not even let you hold open a connection for more than a minute or two.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM