I need to get mails only from today with subject.Contains and count them, if there are 0 mails, then I need to send an alarm mail.
- Create a counter variable(say counter1) and give default value as 0.
- Get the mails using get outlook mail messages activity and store mails in a variable(say Mails)
- Now use for each loop. For each mail in Mails
if(Convert.ToDateTime(mail.Date).ToString(“dd-MM-yyyy”).Equals(now.ToString(“dd-MM-yyyy”)) and mail.subject.contains(“YourSubjectToCheck”)),then increment counter1
In the for each loop properties, you should select the data type as System.Net.Mail.MailMessage for the “TypeArgument” property.
“Now” is a default variable in .net which returns current date and time.
- After for each loop is finished, check counter1 value using if condition. If counter1 = 0 , then send alarm mail using send outlook mail message activity.