Fetch last 30 day mail imap uipath

i am trying to access only last 30 day mail from now with the use IMAP.
how to do that

1 Like


We can’t do this using Get IMAP Mail Message activity.

If you have Outlook application installed in your machine then use Get Outlook Mail Message activity to retrieve last 30 days mails from now. And specify the same in Filter option of Get Outlook Mail Messages.

Hi Buddy @divyanshu.innowise

Welcome to UiPath community buddy
Kindly follow the below steps that could help you resolve your issue buddy

  1. There are many activities that can used out here for getting the mail like get outlook mail activity and get imap mail activity, get exchange mail activity
  2. In which get outlook mail activity has a special property where we can filter out even before we get the output variable from that activity with filter property while the other you need to get the list of mailmessages which will be the output of those get mail activities and we need use if condition and then only we can accese the mail of last 30 days…
  3. Its all our option, whether to go for outlook if your system is configured with MS Outlook and your mail is connected with outlook as well…then we can use get outlook mail activity
  4. Or if you dont have outlook configured in your system, you can use the other activities buddy but the difference is not only the outlook been configured to your system but another thing is we dont need to pass the credentials, user details as input to get outlook mail activity as it would take it automaticaly while we need to give them with other activities as input
    5…Alright coming to the point, if you are using outlook mail activity use the filter as like this
    "[ReceivedTime] < ’ " + now.AddDays(-30) + " ’ "
    simple buddy just one step
  5. or if you are using other activities get the output from those activities with a variable name out_mailmessages and iterate through each mail in them with for each loop
  6. pass the above variable as input to for each loop and change typeargument as mailmessage…inside the for each loop use a if condtion and mention like this buddy
    item.Headers(“Date”) < now.AddDays(-30)

thats all buddy you are done
Kindly try this and let know buddy whether this works or not
Cheers @divyanshu.innowise

were you able to get now buddy @divyanshu.innowise

thanks man it works
keep supporting by solving these small doubts

1 Like

Cheers buddy

1 Like

@Palaniyappan i dont know how to close it

1 Like

please see my next question too @Palaniyappan

i am giving the link

1 Like

sure buddy

were you able to close this topic buddy @divyanshu.innowise

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