How to put condition in if condition to read only yesterday mail

Hi all, I need a expression to read only yesterday mail in if condition, suggest a method to implement it.
Thanks in advance :cowboy_hat_face:

@Gopi_Krishna1,

Same like this,

just change the condition to this.

Cdate(currentMailMessage.Headers.Item("Date")).Date = DateTime.Now.AddDays(-1).Date

Thanks,
Ashok :slight_smile:

Hi @Gopi_Krishna1

Instead of using the If condition you can directly filter the yesterday mails by giving the below filter expression in filter option in Mail Activity properties.

Check the below filter option to filter the yesterday Mails,

"[Received] >= '" + DateTime.Today.AddDays(-1).ToString("d") + " 00:00AM' AND [Received] < '"+ DateTime.Today.ToString("d") + " 00:00AM'"

Hope it helps!!

1 Like