Automation to be triggered based on email


we have a system in our residential building for all residents to receive our deliveries via intelligent lockers downstairs.
When delivery comes, they deposit in certain locker and the system notifies me with an email.

Delivery arrived:
Ref Number: xxyyzz (this reference number is randomly generated and changes for each delivery)

After any family member gets delivery from locker, another email arrives.

Delivery retrieved:
Ref Number: xxyyzz

so for each delivery arrived, there would be delivery retrieved with same reference number.

I would like this use this email (forward to home assistance if needed) and run an automation which should indicate if there is delivery waiting. After retrieval I intend to remove this indication by another automation.

any ideas, suggestions?
I cant find much info about automation trigger by an email.

Thanks in adv

Have you looked at the gmail integration?

Based on how well that works with the mail & packages addon, I’m not sure that’s something I’d ever recommend to anyone. LOL