Gmail Trigger in Maestro fetches old email during test & cannot mark as read

Hi everyone,
I am currently working on a process in UiPath Maestro BPMN (Studio Web) using a Message Start Event with the Gmail Connector (specifically the “Email Received” activity).

When I test the process, I expect the trigger to wait for a new email to arrive in the inbox. However, it doesn’t wait. Instead, it immediately fetches the most recent existing (old) email from the inbox and runs the process using that email as the payload.
Why does it happen like this, and what is the logic behind it?
Also, I cannot seem to mark the email as read. Any ideas on how to fix this?

Thanks in advance for your help and insights!

Hi @iboti57

I think this is because the Email Received trigger checks the mailbox when the process starts, so during testing it can pick up an existing email instead of waiting for a new one.
Try testing with a fresh/test mailbox and send a new email after starting the process.

For marking the email as read, check if the Gmail Connector has a Mark as Read/Update Email action and run it after processing the email. Also make sure the trigger is pointing to the correct folder and filters.

Thanks for the tips! I’ll add the update action to the workflow and test again with a clean inbox

Hi iboti57,
This behavior is expected with the Gmail “Email Received” trigger in UiPath Maestro/Studio Web. When the trigger is first created or tested, it can pick up the latest existing email in the inbox as the starting event instead of waiting for a brand-new email. This happens because the trigger needs a reference point and may process emails that match its monitoring criteria.

How to fix it:

  • Make sure the trigger is published and running before sending a test email.
  • Add filters (sender, subject, label, etc.) so only new emails matching the criteria are picked up.
  • Delete or move old matching emails from the inbox before testing.
  • Check if the trigger supports an option like “Only new emails” or similar and enable it if available.

Regarding marking emails as read:

  • The Email Received trigger only detects the email; it does not automatically mark it as read.
  • After the trigger fires, add a Gmail action such as Modify Email / Mark as Read using the email ID from the trigger payload.
  • Ensure the Gmail connection has the required permissions to modify emails.

In short, the trigger is behaving based on existing matching emails in the mailbox. Start the process first, send a fresh test email afterward, and use a separate Gmail action to mark the email as read.

Thanks

@iboti57

Welcome to the community

its expected behaviour when you run in debug mode or from maestro directly

but once you publish it would get triggered only for new emails

for markign as read in start events its a known issue as of now use separate activity to mark it

cheers

Hi Anil_G,
thanks for the warm welcome and the quick clarification. It’s good to know it will work fine once published. I will add a separate activity to mark the email as read as you suggested.
cheers

Hi, thank you for the detailed explanation!