Geary IMAP error 7 (missing email identification number): workarounds?

Good morning everyone!
Today’s issue is with Geary.
I use a somehow obscure email provider I’d like to read mails from with Geary.
Since using Gnome, I configured that account through Gnome Setting Panel.
Geary shows up and correctly reads all folders’name on email server and how many mails in each folder.
Then becames stuck.
Investigating this issues (–imap-deserialize option from CLI) it logs:
*[wrn] 13:08:12.0102 Geary: [GearyImapClientSession(selecting, GearyImapClientConnection(000E/imap.emailprovider.uk:143/up)), Imap.Folder(>Templates), ro: unknown, permanent_flags: (none), accepts_user_flags: unknown] GearyImapFolderSession: Ignoring bad UIDNEXT 0 from server
*[wrn] 13:09:06.0057 geary:imap-status-data.vala:113: Ignoring bad UIDNEXT 0 from server

It looks like as cannot correctly read emails’UIDs.
Is there an hack to solve this issue?

I tried to get in touch with Geary developers in Matrix/discord/… but nobody seem available.

Thank You!

No, the server just send UIDNEXT 0 while it should send the next predicted mail UID. It is a wrongly configured mail server and geary just ignores it, because it is an extended feature, but unnecessary.

See:

Ok, but then Geary keeps on hanging trying to download mails.
What else could be and where do I have to dig out harder in the logs?

It is the mail server, not the client. Do you manage the mail server yourself?

no. Months ago I used mailspring as a client and it did work fine out of the box…

@alimurgia Well no idea. I don’t connect to a server which supports UIDPLUS. Can you check your servers capabilities?

openssl s_client -connect domain:port -quiet

Example:

* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN AUTH=LOGIN] Dovecot ready.

Ok, I get:
openssl s_client -connect mailserver.xyz:993 -quiet

and server answers:
depth=2 C = BE, O = GlobalSign nv-sa, OU = Root CA, CN = GlobalSign Root CA
verify return:1
depth=1 C = BE, O = GlobalSign nv-sa, CN = AlphaSSL CA - SHA256 - G4
verify return:1
depth=0 CN = *.mailserver.xyz
verify return:1

  • OK mailserver.xyz IMAP service ready

If I query on port 143, I get:
40E7842F8E7F0000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:ssl/record/ssl3_record.c:354:

Looks like a microsoft exchange server or an selfhosted “Office365” mail server, which doesn’t send its capabilities, what ever that is.

I would inform the admin about this misbehavior or use a client which supports such servers. Mailspring supports Office365 as I see, Geary seems not, only Linux servers were tested as it seems.

Ok, thank You. I get in touch with that admin. Hopfully, they will redeem themselves…

Done. Waiting for reply:

Hallo everyone!
I was looking to remotely access Firemail via IMAP with a Linux client (Gnome Geary) but did not work.
I investigated the problem with the help of some expert in the Linux community to track down the cause of the problem that seems to be:
“Looks like a microsoft exchange server or an selfhosted “Office365” mail server, which doesn’t send its capabilities, what ever that is.
I would inform the admin about this misbehavior or use a client which supports such servers. Mailspring supports Office365 as I see, Geary seems not, only Linux servers were tested as it seems.”

Could You please try to solve this problem?
It seems it should work this way:
when the remote client contacts you:
openssl s_client -connect domain:port -quiet

Foremail server should also reply something like this:

  • OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN AUTH=LOGIN] Dovecot ready.

Thank You!

On the other hand, is there any working way to contact Geary support to ask them to bypass the problem (since e.g. Mailspring did it…)?

You can also try that:

telnet domain 143

or

 openssl s_client -connect domain:993 -quiet

Then enter:

02 capability

That should display it.

telnet server.xyz 143
Trying xx.zz.yy.ww…
Connected to server.xyz.
Escape character is ‘^]’.

  • OK server.xyz IMAP service ready
    02 capability
  • CAPABILITY IMAP4rev1 STARTTLS AUTH=PLAIN AUTH=LOGIN QUOTA IDLE XAPPLEPUSHSERVICE
    02 OK CAPABILITY completed

But, again, how do I now inform geary about these new superinfos?

No, Geary gets it itself just like you did. That is not the problem.

The problem is that the server sends you a bad UIDNEXT. It is not allowed to be 0, therefore it troughs an error.

I found this explanation: Syntax error in UIDNEXT response code. Unexpected token: [atom: 0] · Issue #1010 · jstedfast/MailKit · GitHub

Ok, according to You, is there any chance to hack it somehow on my side?
I mean, patch Geary source to substitute that 0 for * CAPABILITY IMAP4rev1 STARTTLS AUTH=PLAIN AUTH=LOGIN QUOTA IDLE XAPPLEPUSHSERVICE ?

(Just the same they asked for and did in the very same thread You pointed to :slight_smile: )

No, the client can ignore it. That’s it. But it is already done here:

So the admin fixes it?

Dunno, didn’t reply, yet…
I would just inject that string (I am just a bit of a stubborn) and go on with Geary (metacode. No idea how real code would look like):

if (response_code.get_as_string(1).as_int64() == 0) {
response_code.get_as_string(1).as_int64() == “CAPABILITY IMAP4rev1 STARTTLS AUTH=PLAIN AUTH=LOGIN QUOTA IDLE XAPPLEPUSHSERVICE”
}

Also, a Telnet subroutine same You suggested before could be of use to retrive the values to be injected.

Good luck. :see_no_evil: :no_mouth:

Thank You!
Btw, another headache to put on the todo list :wink: