Break the ForEach Loop

I am trying to automate the birthday email using birthday emails.
Initially I am putting .txt file as template and only two email address in “To” . And I am using the For-each loop. What I want is that after an Iteration it execution should stop…
Can you please tell me how I can use break here and so that after a single iteration, it gets stopped

1 Like
1 Like

What should I do , If I have only this as my problem… In my workflow this is the only problem… In that case I want to stop execution when each user get the email one time (In my case there are two user I am entering) and execution should stop. What should I do ??

Hi @sachinl

Use for loop…it iterates to all the users and sends the mail exactly one time…

Hi @sachinl

I Have one question… From where are you getting the birthday email address list? The text file you mentioned contains the mail message right? So, i suppose you are iterating the email list using a for each loop to send the message in your text file.

So how does your email address list look like?

1 Like

Hey @Lahiru.Fernando → I am putting the emails manually like this e.g. “;” … Yeah in the text file which I mentioned contains the email template…

@Lahiru.Fernando @GouthamVijay @KarthikByggari → I am very new to this UIpath. I am in learning phase , so may be my doubts are quite basic…

1 Like

@sachinl No worries… we can help you figure it out…

So, the way you enter looks fine. My question here is, where do you enter this manually? Does your process show up a input dialog where you type this full list of emails? Or is it coming from a text file or something?

1 Like


From where you are reading emails, is it from an excel file?

Here I am putting address. I hope this is quite understandable

For each

SMTP mail message

1 Like

And the template file is in desktop… I am taking it from desktop…

1 Like

@GauthamVijay I am not getting For loop option in my community addition…

Hi @sachinl

Your flow seems to be wrong here.

  1. Read text with template - fine
  2. For Each - here you are looping through the template, which is not right
  3. User list are given as one line in your SMTP, so the way you have done it, we are unable to loop through them.

So, to make it easier, I have created a sample workflow for you. I have also added comments so that you can easily understand why I have used them…

LoopthorughEmailAddressList.xaml (12.2 KB)

Hope this helps you to understand how it should be done in a simpler way :slight_smile:

If it works, please also make sure to mark my answer as the solution too…


Hello @Lahiru.Fernando → Thank you so much… This will be greatfull for me… I will try and acknowledge you… :slight_smile:

1 Like

Hi @sachinl

Were you able to solve your issue?

Hello @Lahiru.Fernando → I am pretty much able to understand this … I will continue with further learning… Will ask you If I will face any issue…

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.