Using mail-poll connector to retrieve unread emails only

I’m trying to design a process where I check my Gmail inbox, and if there are new emails I trigger the next task. But if there are no new emails then I end the process.

I created a service task that uses the mail connector to retrieve messages from my inbox folder but it retrieves all the messages in the inbox in an ArrayList. Is there a way that I can retrieve only the unread messages?
This is usually achieved by setting the seen flag to false when checking the mailbox.

I searched the docs/forums and looked at the pizza mail example but couldn’t find anything about that.

Is this possible with the mail-poll connector or do I have to write my own code?

Project environment:

Camunda BPM 7.13
Spring Boot.
camunda-bpm-mail-core 1.2.0

Hi @Joe,

this is currently not possible. But I would be easy to implement in the connector. Feel free to open a PR and I’m happy to merge it :slight_smile:

Best regards,
Philipp

1 Like

Can anyone help me to understand how mail-poll example - print-service (workflow- https://github.com/camunda/camunda-bpm-mail/tree/master/examples/print-service) will get invoked as soon as any mail comes to inbox.
I feel clueless here

Hi @teja_polisetty,

please have a look at the description in the repo:

but instead of sending mail via java code, how is it listening to the incoming mail in Gmail or outlook or any such account.
Can you share any such listener? That would be a great help
Thanks