Hi folks,

in our environment, we need to synchronize the state of messages within James (using JPA mailbox) with an external system. This means that (i) when messages get fetched/deleted using IMAP, I want to call some Java code that updates an external database and (ii) when changes to the external database are made, the corresponding message flags should be set in the James database.

In order to achieve that, I thought about the following approaches:

Regarding (i) the MessageListener may be of help, since it allows to provide hooks for flags such as SEEN and DELETED. In this respect, my question would be how to register my own MessageListener implementation?

In terms of (ii), the cleanest approach would be store the messageId of the external system within a custom JPA entity inheriting from JPAMessage. The corresponding messageId would be transferred as a header of the MimeMessage to store. This means, I would require to add some custom code, when the JPAMessage is created based on the MimeMessage. Is this possible in James, and if so, could someone provide me with a hint how to do this?

Thanks and best regards,
Marco


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to