Copy valid email adresses to "ToAddress" outlook email

Hi Team,

I have 5 email ids as below:
Email ID 1:"rajesh@gmail.com"
Email ID 2:"thodeti@gmail.com"
Email ID 3:“”
Email ID 4:"raj@yahoo.com"
Email ID 5:“null”
I want to take only email addresses and remove other values(blank or null or N/A)as below:
SetofEmails(String):rajesh@gmail.com;thodeti@gmail.com;raj@yahoo.com

Appreciate your help @Palaniyappan @lakshman @Reddy_Paluri

1 Like

@RajeshT

You can check the string

IF - YourString.Contains(“@”)

Add to collection activity

Mark as solution if this helps

Thanks

1 Like

Fine
Let’s take like you have these email address in a list or array variable
—So use a FOR EACH activity and pass that list or array variable
—inside the loop use a simple IF condition like this
Not item.ToString.Contains(“Null”) AND Not String.IsNullOrEmpty(item.ToString) AND Not Item.ToString.Contains(“N/A”)

If true it will go to THEN part where use a ADD TO COLLECTION activity
Where in the item property mention as item.ToString and in collections property mention a new list variable like this list_output which is defined in the variable panel of type System.Collections.Generic.List(of string) with default value as New List(of String)

—now after this for each loop use a assign activity like this
str_maillist = String.Join(“;”,list_output.ToArray())

This will give you the expected outout

Cheers @RajeshT

4 Likes

Thank you @Palaniyappan.
Its working as expected.

1 Like

Cheers @RajeshT

1 Like

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