Your question
We’re currently only partially using JMAP, e.g. for push notifications / subscription.
When I receive a push e.g. for a new arrived mail, I get a JMAP messageId and need to convert it into an IMAP uid our system needs to update the list of mails.
With Stalwart v0.12 I send via IMAP a query for mails in the given folder with a Message-ID header matching the messageId I received.
This seem to have changed with v0.16, the JMAP messageId seems no longer the Message-ID from the mail headers.
How can I convert with v0.16 a JMAP messageId to an IMAP uid?
Ralf
The key point here is that the JMAP id for an email (as used in Email/get, Email/changes, push notifications, etc.) is Stalwart’s internal object identifier – it is distinct from the Message-ID header of the email. This is standard JMAP per RFC 8621. The correct approach to convert a JMAP email ID to an IMAP UID is to use JMAP itself to retrieve the header:Message-ID:asMessageIds property, and then use that for an IMAP SEARCH, OR – better – to use the JMAP Email/get call to get the full picture directly without ever needing IMAP.
However, the cleanest path for your described use case (JMAP push → IMAP UID) is to use the JMAP Email/get method to fetch the email by its JMAP ID requesting the header:Message-ID:asMessageIds property, then match with IMAP. But let me verify if there’s a more direct IMAP-UID-from-JMAP-ID path in the server source.
There isn’t a direct conversion exposed over the wire. The JMAP email id is a synthetic id built from the thread id and an internal document id; it isn’t the RFC 5322 Message-ID header, which is why matching on the header changed behaviour. The IMAP UID is a separate value assigned per mailbox, so you can’t derive it from the JMAP id, and decoding the document id from the JMAP id won’t give you the UID either.
If you need to correlate the two, please check the OBJECTID and JMAPACCESS IMAP extensions.
Ok, I’m using OBJECTID now, so I can switch indexing the header off again 
Ralf
Note that in the near future Stalwart will switch to OBJECTID+.
Thx 
Good that the SEARCH EMAILID syntax stays the same.
Ralf