Skip to main content

after email trigger action, using email:connect, and email:delete would understand which email it should delete? or what should I do?

Also I made 20 seconds of email trigger, even though it triggers bot, it constantly trigger bot again and again. How to get rid of this?

Hi,

The Email Trigger action in Automation Anywhere currently doesn’t expose the triggering email directly to the rest of the bot as an object. So if you want to delete the triggering email after the bot runs, you must:

  1. Use Email Trigger – Set up with appropriate conditions (subject, sender, etc.)
  2. Inside the triggered bot:
  • Add Email: Connect
  • Use Email: Get messages with same filter (subject, sender, time range) and Sort by: Date descending
  • Process only the latest email (assume it’s the one that triggered the bot).
  • Use Email: Delete on the same message.

Note: 

  • If multiple emails match, and the trigger fires quickly, you might mistakenly delete the wrong one.
  • A better approach is to store email UIDs in a temporary file or dictionary when processing, and use the UID to delete the exact one.

 

For your second question regaring - Why is my bot being triggered multiple times?

This is a common issue when:

  • The email remains in the inbox (so it keeps matching the trigger condition).
  • The polling interval is too short (e.g., 20 seconds).

How to prevent repeated triggers?

  1. Delete or move the triggering email after processing.
  • Use Email: Delete or Email: Move to Folder (e.g., "Processed").
  1. Avoid short intervals – Use a longer polling interval, like 1-5 minutes depending on volume and urgency.
  2. Add logic in your bot to check for:
  • Email UID or Timestamp already processed
  • Store in a list/CSV/cache and skip duplicates.

For example:
- Trigger Bot on New Email (Subject = "XYZ")
- Email: Connect
- Email: Get Messages (Filter: Subject = "XYZ", Limit: 1, Sort: Date Descending)
- Store UID or MessageID
- Process Content
- Email: Delete using UID
 


@madhu subbegowda Hello, thank you for your helpful reply. I have a question. Whats email:get messages step? Are you saying email:Loop action?


Reply