Filter mail message

I am reading mail message with activity get imap mail message, how i can filter it to get only today’s mail messages.
I assigned
“inbox_mail_readign.Where(Function(x) DateTime.ParseExact(x.Headers(“Date”), “MM/dd/yyyy HH:mm:ss”, Nothing).Date.Equals(DateTime.Now.Date))”
to another variable and it is giving only today’s mail message as per my requirement but when i am iterating through for each loop with this variable it throwing error saying ‘String was not recognised as a valid DateTime’
How can i solve this issue?

Thanks in advance


This error means that you are using incorrect date format, have you used writeline/message box or other method to check what kind of format is used to write the date ?

1 Like