IMAP unread mails with imap.telenet.be

Trying to use the IMAP unread mail integration like this:

Getting the following errors:
Setup of platform imap is taking over 10 seconds.
Platform imap not ready yet. Retrying in 180 seconds.
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/aioimaplib/aioimaplib.py”, line 296, in wrapper
res = yield from coro(self, *args, **kargs)
File “/usr/local/lib/python3.7/site-packages/aioimaplib/aioimaplib.py”, line 441, in welcome
yield from self.capability()
File “/usr/local/lib/python3.7/site-packages/aioimaplib/aioimaplib.py”, line 560, in capability
raise Error(‘server not IMAP4 compliant’)
aioimaplib.aioimaplib.Error: server not IMAP4 compliant

All help is appreciated!
Hard to imagine that Telenet is still using version 2 for IMAP (3 never existed though)?
Other users that tried this integration with imap.telenet.be?
using latest version of HA 0.97.2.

This seems to be in bug in the third-party aioimaplib library, it expects the “IMAPrev1” to be the first capability (index 0): aioimaplib/aioimaplib/aioimaplib.py at 9670d43950cafc4d41aab7a36824b8051fa89899 · bamthomas/aioimaplib · GitHub

However, imap.telnet.be returns capabilities in roughly alphabetical order:

$ telnet imap.telenet.be 143
Trying 2a02:1800:100:3::3...
Connected to imap.telenet.be.
Escape character is '^]'.
* OK IMAP4rev1 proxy server ready
a capability
* CAPABILITY ACL BINARY CATENATE CHILDREN CONDSTORE ENABLE ESEARCH ID IDLE IMAP4rev1 LIST-EXTENDED LITERAL+ MULTIAPPEND NAMESPACE QRESYNC QUOTA RIGHTS=ektx SASL-IR SEARCHRES UIDPLUS UNSELECT WITHIN ESORT I18NLEVEL=1 SORT THREAD=ORDEREDSUBJECT LIST-STATUS XLIST STARTTLS LOGINDISABLED
a OK completed

which seems to be acceptable by the IMAP RFC 3501:

The server MUST send a single untagged CAPABILITY response with “IMAP4rev1” as one of the listed capabilities before the (tagged) OK response.

That should give you enough information to file a bug report in the aioimaplib issue tracker :slight_smile:

Okay, will do!
I suppose ha will dynamically link to the update if one comes?

A separate change must be made to Home Assistant to use the new version (so that only tested versions are used).