How to check if a mail is read or unread and than start a process

email
activities

#1

Hello,

Can anyone of you tell me please, how to check if a email new/old, read/unread and has arrived. I want to check if a new email has arrived, if yes, then a process shoul start.

Thanks al lot !!!
Regards :slight_smile:


#2

Hello,

I don’t know if this is the best approach, but the Get Exchange mail activity has an OnlyUnreadMessages and Top parameter. If you set Top to 1, it will only take the first unread message or increase the number to pull a list of unread messages. For this solution to work you will probably need to check MarkAsRead and ensure there are no unread messages.

You can also opt to look at the date with .Headers like cdate(mailmessage(0).Headers(1))

Then, you can use a condition like If(mailmessage.Count>0,cdate(mailmessage(0).Headers(1))>Now.AddDays(-1),False)
and maybe a For each to process the new mails

Regards.


#3

Thanks :slight_smile:
The first Thing you said, i tested it and it works. But the process starts if there is no email. I want to start the Process after i get a new mail. But if there is no new mail or unread mail, my Robot should try it later. But i can handle it. I have read something about an decision flow, but i don´t know how i can use it.