Read Mail Body Content by applying time filter

Hiii, We Use the UiPath community edition 2023.4 version.
I Want to design a job For Read Mail Message Body Content But Read Only Those Mail That sends before 15 minutes. And Mark as Read. Is it possible? It Yes Then, how can I apply the Time condition?
Please help Me Resolve My Issue.

Hi @ashwini.mali

While using the Get Outlook Mail Messages activity, go to the property & apply the following filter:

"[ReceivedTime] > '" + DateTime.Now.AddMinutes(-15).ToString("MM/dd/yyyy HH:mm:ss") + "'"

Hope this helps,
Best Regards.

Thanks For your reply, @arjunshenoy
I used Get Mail MessageActivity for read mail, and filter on the subject read only specific subject mail(“Subject:(UiPath SMTP Activity Testing)”) , so above solution where add.and how add 2 filter condition .1 for mail subject 2.for time

@ashwini.mali

Please try the following expression:

"[ReceivedTime] > '" + DateTime.Now.AddMinutes(-15).ToString("MM/dd/yyyy HH:mm:ss") + "' AND Subject:'UiPath SMTP Activity Testing'"

Hope this helps,
Best Regards.

Try above solution but it not read any message body,what is mean by received time ,I mean its function or what ? @arjunshenoy

Please replay

Hi @ashwini.mali

Try this-

Add a For Each activity to iterate through each mail message retrieved by the previous activity. Within the For Each loop, use an If activity to check the SentDate property of each mail message. Compare it with the current time minus 15 minutes.

mailMessage.SentDate > DateTime.Now.AddMinutes(-15)

Thanks!!

Hi @ashwini.mali ,

Try the below in filter:

"[ReceivedTime] >= '" + DateTime.Now.AddMinutes(-15).ToString("MM/dd/yyyy HH:mm tt") + "' AND [Subject] = '(UiPath SMTP Activity Testing)'"

Regards,

ReceivedTime is function ? dynamically store received time

Try Above solution but not work for me @vishal.kp

@ashwini.mali
Can you check if the email is already read, or the subject is proper.

Regards,

Checked ,mail was not read and subject is also right

@ashwini.mali ,

Was the email received in last 15 mins?

Regards,

Yes @vishal.kp

Hiii @Nitya1 try above solution but getting error ,Please check attached Screen shot And Help me to resolved isssu


Hi @ashwini.mali
Try this
currentmail.Date > DateTime.Now.AddMinutes(-15).ToString