I need to filter mails based on sender mail address and subject

I need to filter mails based on mail address : abc@gmail.com and subject will be like “Balance confirmation”.

Hi @sathish_moorthy

Try this in Filter Property of Get Outlook Mail Messages

"[SenderEmailAddress] = 'abc@gmail.com' AND [Subject] = 'Balance confirmation'"

Regards

Hi subject will be having balance confirmation 55553 .The numbers will be changing

Hi @sathish_moorthy

Try this:

"[SenderEmailAddress] = 'abc@gmail.com' AND [Subject] LIKE 'Balance confirmation %'"

Regards

It is not working. It is showing condition is not valid

@sathish_moorthy

Can you share the screenshot.

Regards

Hi @sathish_moorthy

=> Use Get Outlook Mail Messages and store the output in a variable say MailMessages.

=> Use the below syntax in Assign activity:

MailMessages = MailMessages.Where(Function(mail) mail.SenderEmailAddress.Equals("abc@gmail.com") And mail.Subject.ToString.Contains("Balance confirmation")).ToList()

=> Use For Each loop to iterate through MailMessages variable and continue with further process.

Note: Please remove the filter condition in properties panel of Get Outlook Mail Messages.

Regards

Hi @sathish_moorthy ,

  1. Use this filter in the subject line.
"@SQL=(" "urn:schemas:httpmail:subject" "LIKE '%Balance confirmation%')"
  1. Take assign activity to filter the mails based on email id,
    Listofmail as Arrayof(MailMessage)
(From m In Mailmsg
Where m.Sender.Address.Trim().Equals("attendance@predoole.com")
Select m).ToArray()
  1. For each activity, iterate from Listofmail.

Regards,
Vinit Mhatre

  1. Get Outlook Mail Messages: Drag an “Get Outlook Mail Messages” activity onto your UiPath workflow. Configure it to connect to your Outlook account and retrieve emails.
  2. Loop Through Emails: Use a “For Each” loop activity to iterate through each email retrieved.
  3. Filtering by Sender: Inside the loop, use an “If” activity to check if the sender’s email address matches the desired address (e.g., “abc@gmail.com”). You can use the item.From.Address property to get the sender’s email address.
  4. Filtering by Subject: Within the same “If” activity, add a condition to check if the subject contains the desired phrase (e.g., “Balance confirmation”). You can use the item.Subject.Contains("Balance confirmation") condition.
  5. Perform Actions on Matching Emails: If both conditions are met, perform the desired actions, such as saving the email attachment, marking the email as read, moving it to a specific folder, or extracting information from the email body.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.