For each into a variable

Hello everybody,
i have a for each wich checking incoming EMails.
I can do a write Line so i can see from of the incoming emails.
Now i want to have a variable wicht storing the from value. I would like to use an if loop to check whether the emails are there.


How can i do that?

Thank you


Use Assign activity and create a variable as a string eg: mailFrom

mailFrom = mail.From.ToString

After that you can place a IF condition and you check as below
Eg: mailFrom = “

Note: These activities should be within the For Each sequence only

Hope this helps you


Thank you for the answer. But it doesnt work :frowning: the write nothing into the variable.

Can you build a example for me ?

Thank a lot

Now it work i have it in the String … can you make me a example how i have twp place the if ? it should be 3 if loops. thanks


Before for each you place a If condition to check the count of mails as below

You can use IF’s or Switch activities for this

If you have limited number of IF’s then use as below

But you need more IF’s you can consider Switch activity as below

Hope this helps you


Excuse me, maybe you could build me a complete example from the start with the activity "Get outlook Mail Message?
The robot should check whether 3 emails from the senders Marcus, Steven, Curtis have arrived. If one has not arrived, he should send a message. And say the message from … is not in the inox.

sorry for my lack of experience

And the for each should store all 3 Senders in one variable . not every for each running on other :slight_smile: