How to count unread mail in uipath
To count unread mail in UiPath, you can use the Get Mailbox Items
activity and then filter the results to only include unread emails. Here's an example of how you can do this:
- Add a
Get Mailbox Items
activity to your workflow and configure it to connect to your email account. - In the
Get Mailbox Items
activity, set theQuery
property toUnread
to retrieve only unread emails. - Add a
For Each
activity to iterate through the retrieved email items. - Inside the
For Each
activity, add aGet Item
activity to retrieve theUnread
property of each email item. This property will beTrue
if the email is unread andFalse
if it's read. - Add a
Counter
activity to count the number of unread emails. You can use theIncrement
property to increment the counter for each unread email.
Here's some sample code to illustrate this:
// Get unread emails
Get Mailbox Items
Query = "Unread"
Mailbox = "your_email_address"
Password = "your_email_password"
// Iterate through the retrieved emails
For Each item In Get Mailbox Items.Output
// Check if the email is unread
If Get Item(item, "Unread") Then
// Increment the counter
Counter.Increment
End If
End For
// Display the count of unread emails
Message Box "Unread emails: " & Counter.Value
Note that you'll need to replace your_email_address
and your_email_password
with your actual email address and password.
Also, keep in mind that this is just an example and you may need to modify it to fit your specific requirements. For example, you may want to filter the emails by subject, sender, or date range, or you may want to count only emails from a specific folder.