pulb / mailnag

An extensible mail notification daemon
GNU General Public License v2.0
250 stars 32 forks source link

Mail folders with spaces raise an exception #206

Closed marcriera closed 4 years ago

marcriera commented 4 years ago

Hello,

I use Mailnag with 2 Gmail accounts, both with specific folders selected. I have noticed that selecting certain folders prevents new mail notifications from appearing, and on further investigation it seems that mail folders with spaces raise an exception. I have tested several folders with accented characters and they work fine, the problem seems to be just with spaces and not with other characters.

Here is the output from journalctl ("ABC DEF" is the name of the folder):

INFO (2020-05-18 18:36:25): Checking 2 email account(s).
ERROR (2020-05-18 18:36:27): Caught an exception.
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/Mailnag/daemon/mailnagdaemon.py", line 172, in _start
    self._mailchecker.check(self._accounts)
  File "/usr/lib/python3.8/site-packages/Mailnag/daemon/mailchecker.py", line 53, in check
    all_mails = self._mailsyncer.sync(accounts)
  File "/usr/lib/python3.8/site-packages/Mailnag/daemon/mails.py", line 195, in sync
    rcv_lst = MailCollector(self._cfg, accounts).collect_mail(sort = False)
  File "/usr/lib/python3.8/site-packages/Mailnag/daemon/mails.py", line 69, in collect_mail
    for folder, msg in acc.list_messages():
  File "/usr/lib/python3.8/site-packages/Mailnag/backends/imap.py", line 85, in list_messages
    conn.select(folder, readonly = True)
  File "/usr/lib/python3.8/site-packages/Mailnag/common/imaplib2.py", line 1051, in select
    self._deliver_exc(self.error, '%s command error: %s %s. Data: %.100s' % (name, typ, dat, mailbox), kw)
  File "/usr/lib/python3.8/site-packages/Mailnag/common/imaplib2.py", line 1465, in _deliver_exc
    raise exc(dat)
Mailnag.common.imaplib2.IMAP4.error: EXAMINE command error: BAD [b'Could not parse command']. Data: ABC DEF

Thank you!