Hi, how can I get all emails which date is a day before the current day time using IMAP?
I have an If activity with this condition but it´s not retrieving anything:
CurrentMail.Subject.Contains(in_Config(“EmailSubject”).ToString) And CurrentMail.Headers(“Date”) = Now.AddDays(-1).ToString
I am thinking it has to do with the date format. By default DateTime.Now.ToString will return the format as ‘MM/dd/yyyy’ you may need to tweak it for example if the server returns the full timestamp you may need to use contains instead of =
Are you able to post a sample of one of your email headers so I can provide more insight?
Sure, does this works?
So yeah, your header contains the full timestamp if you do an = comparison with Date.Now is never going to match because of the time.
Try: CurrentMail.DateAsDateTime.ToString(“MM/dd/yyy”).equals(Date.Now.AddDays(-1).ToString(“MM/dd/yyyy”))
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.