How to Get Zimbra Message ID (Not Postfix Message ID)

Have a great idea for extending Zimbra? Share ideas, ask questions, contribute, and get feedback.
Post Reply
DaveSmash
Posts: 10
Joined: Tue Mar 06, 2018 1:44 am

How to Get Zimbra Message ID (Not Postfix Message ID)

Post by DaveSmash »

Hello. I am trying to integrate with a third-party app. I would like to notify the app of new incoming and outgoing messages, and include the Zimbra Message ID for direct linking purposes, e.g., https://mydomain.com:7070/home/john.doe/?id=123. I am trying to use zmmsgtrace to log recent messages, but it only gives me the Postfix message ID (like 23742137490234.123498723094721904.21342134.JavaMail.Zimbra@mydomain.com), not the Zimbra message ID (like 123). I have also tried "tail -f ~/log/mailbox.log" to monitor for sent/received notifications, but that log also gives the Postfix ID instead of the Zimbra ID. The only way that I know how to find the Zimbra ID is manually, by opening the webmail client, right clicking the message, and clicking "show original" to see what ID is used in the URL.

Is there a way to look up the Zimbra message ID if you know the Postfix Message ID, or can somebody recommend a better approach to solving this problem? Thanks in advance!
DaveSmash
Posts: 10
Joined: Tue Mar 06, 2018 1:44 am

Re: How to Get Zimbra Message ID (Not Postfix Message ID)

Post by DaveSmash »

I still welcome any advice or feedback, but I am working through a solution. For anyone else looking for a solution to this problem, it looks like Zimbra IDs are included with the response from the REST API when you get a folder's contents (e.g., http://mydomain.com/home/john.doe/Inbox/?fmt=json). As far as knowing when to grab the data, you can poll at a regular interval, or presumably you could monitor the logs as I was attempting to do in order to see when there is new content in the inbox or the sent messages folder.
User avatar
msquadrat
Advanced member
Advanced member
Posts: 183
Joined: Mon Oct 14, 2013 10:09 am

Re: How to Get Zimbra Message ID (Not Postfix Message ID)

Post by msquadrat »

You could also create a WaitSet via the SOAP API which is essentially a long poll and is used eg. by the ZCO as well: https://files.zimbra.com/docs/soap_api/ ... itSet.html

There are a few other ways as well.
DaveSmash
Posts: 10
Joined: Tue Mar 06, 2018 1:44 am

Re: How to Get Zimbra Message ID (Not Postfix Message ID)

Post by DaveSmash »

The waitset looks like a better approach. Thanks for the idea! I will work it into code ASAP.
Post Reply