Email Collector - "From" filters

Hi there,

I’m using Dolibarr version 19.0.3

I would like to add a custom filter to collect emails from IMAP Server.
The filter type is “FROM” and the values ​​will be the emails of the users registered in the system.

For example, if there are 5 users using the application, the emails of these users should compose the filter. So, only matching emails will be collected.

Currently, for a few users it can be included manually, but for a large number of users and for new registrations, it is tedious to do it manually.

Is there any way to be able to apply this filter without having to touch the core of the module?

Thanks in advance.

Two options come to mind:

Most recommended: capture user creation event in a custom module, and add the filter to the corresponding database table. This will happen every time a user is created.

Less recommended: Edit the emailcollector.class.php class to include this filter every time you need to check the IMAP inbox.