You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For some naughty mail providers, ID Command is required when log in.
Will we plan to add the feature officially?
Scenario
Mail Provider:
(Netease) imap.126.com
(Netease) imap.163.com
Raised error message when running imbox.messages():
Traceback (most recent call last):
...
File ".../lib/python3.8/site-packages/imbox/imbox.py", line 100, in messages
return messages_class(connection=self.connection,
File ".../lib/python3.8/site-packages/imbox/messages.py", line 37, in __init__
self._uid_list = self._query_uids(**kwargs)
File ".../lib/python3.8/site-packages/imbox/messages.py", line 48, in _query_uids
_, data = self.connection.uid('search', None, query_)
File ".../lib/python3.8/imaplib.py", line 876, in uid
raise self.error("command %s illegal in state %s, "
imaplib.error: command SEARCH illegal in state AUTH, only allowed in states SELECTED
Tested
A little modifications in code will make it work by my test.
in imap.py, class ImapTransport, function connect, after IMAP login, before IMAP select:
defconnect(self, username, password):
self.server.login(username, password)
# START ID Commandtyp, dat=self.server._simple_command('ID', '("name" "example" "version" "1.0.0" "vendor" "example")')
iftyp!='OK':
raiseException(f'ID Not Accepted. Msg: {dat}')
# END ID Commandself.server.select()
logger.debug("Logged into server {} and selected mailbox 'INBOX'"
.format(self.hostname))
returnself.server
Suggestions
As mentioned in dytttf's work, it's unclear how an imap server will response if it doesn't support RFC 2971 ID Command. Given poor knowledge on IMAP4, I haven't explored a proper solution to automatically detect if server requires ID.
My suggestion is (maybe) to add a vendor for such providers.
For some naughty mail providers,
ID Command
is required when log in.Will we plan to add the feature officially?
Scenario
Mail Provider:
Raised error message when running
imbox.messages()
:Tested
A little modifications in code will make it work by my test.
imbox.py
, on top:imap.py
, classImapTransport
, functionconnect
, after IMAP login, before IMAP select:Suggestions
As mentioned in
dytttf
's work, it's unclear how an imap server will response if it doesn't support RFC 2971 ID Command. Given poor knowledge on IMAP4, I haven't explored a proper solution to automatically detect if server requires ID.My suggestion is (maybe) to add a vendor for such providers.
Reference
The text was updated successfully, but these errors were encountered: