How to get IMAP mails with Filter expression

Hi!
I have seen that not much is said about this new feature of Get IMAP Mail Messages (Filter Expression).
image
What I want to do is a get IMAP mails with Subject filters: Report and today’s date.
I have tried putting SUBJECT = Report but it gives me error
image

Hi Enzo!

When i try to filter mail messages, i use the information of next url:

PLease, check the section: “Outlook Query Languages” and you’ll find some examples. Maybe this helps you.

Hi

Let’s make it very simple

  1. Get the output mailmessage variable without any filter expression from get Imap mail activity named out_mailmessage

  2. Now use a FOR EACH activity and pass the above variable as input and change the type argument as System.Net.Mail.MailMessage in property panel

  3. Inside the loop use a If condition like this

Item.Subject.ToString.Contains(“Report”) AND CDate(item.Headers(“Date”)).ToString.Contains(Datetime.Now.ToString.SubString(0,10))

If true it will GO TO THEN part or to else

Cheers @Enzo

2 Likes

HI! You can find here how filter expression should look like - https://docs.uipath.com/activities/docs/get-imap-mail-messages#filtering-examples

Regards

Please help with the expression to useif want to filter between 2 date variables

Hey,
Did you solve this?
if yes please share the date filter expression format

necesito traer todo lo que esta en Recibidos y despues hacer un filtro