jamesridgway / attachment-downloader

Simple tool for downloading email attachments for all emails in a given folder using an IMAP client
MIT License
85 stars 39 forks source link

Folder name causing very odd crash? #36

Closed rivimey closed 2 years ago

rivimey commented 2 years ago

Not really expecting a useful response, but just in case, I found that trying to filter on a folder named:

GERNews.2022.2022-05 Summer - 191

... failed with the message about search not being valid in the auth state.

However, changing the name of the folder to:

GERNews.2022_191

Made it work. I don't know why or what is going on here.

My IMAP server is Dovecot, I'm using latest (as of now) install of the module & deps, and it's on python3.9 running on a MacBook Pro M1.

This is the log:

2022-05-27 23:20:20,695 - INFO - Logging in to: 'xxx' as 'xxx'
2022-05-27 23:20:20,734 - INFO - Connected to IMAP Server with user xxx on xxx over SSL
2022-05-27 23:20:20,734 - INFO - Listing messages matching the following criteria: folder=GERNews.2022.2022-05 Summer - 191
2022-05-27 23:20:20,737 - INFO - Fetch list of messages from folder 'GERNews.2022.2022-05 Summer - 191'
Traceback (most recent call last):
  File "/opt/homebrew/bin/attachment-downloader", line 112, in <module>
    messages = mail.messages(**filter_options)
  File "/opt/homebrew/lib/python3.9/site-packages/imbox/imbox.py", line 100, in messages
    return messages_class(connection=self.connection,
  File "/opt/homebrew/lib/python3.9/site-packages/imbox/messages.py", line 37, in __init__
    self._uid_list = self._query_uids(**kwargs)
  File "/opt/homebrew/lib/python3.9/site-packages/imbox/messages.py", line 48, in _query_uids
    _, data = self.connection.uid('search', None, query_)
  File "/opt/homebrew/Cellar/python@3.9/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/imaplib.py", line 885, in uid
    raise self.error("command %s illegal in state %s, "
imaplib.IMAP4.error: command SEARCH illegal in state AUTH, only allowed in states SELECTED
jamesridgway commented 2 years ago

Hi,

Do you know what your mail server is using for the hierarchy delimeter?

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.