How to get a particular email message by searching according to subject and dates

I have a excel file contains the following data: code number, center name, email status.
And everyday I received email from my customer according to above excel file and I need to find in my inbox all code number is not sent email and update again to excel file and resend that excel file to my customer. Then, base on the result, they will send email again.

My issue is can not find email according to if does not get email from gmail before by Get IMAP Mail Messages activities —> but limitation of this way is if you does not set TOP value the process can not stop and execute the next activity.
You have any way to login email system, search email by subject and date before then get email & update status?
Anyone can have a solution for this issue and can help me please?

Thank you so muuch


Filter emails using the below, you have to apply this filter in Get Outlook Mail Activity.

“@SQL=(” [ReceivedTime] > ’ " + Now.AddDays(-1).ToString(“MM/dd/yyyy”) + " ’ AND [ReceivedTime] <= ’ " + Now.Date.ToString(“MM/dd/yyyy”) + " ’ “) AND (”“urn:schemas:mailheader:subject”" LIKE ‘%Expiring access rights For departing employee%’)"