Get Outlook mail massages - filter from more then one sender

Hi there,
i want to ask, in my config_settings file, i have IncommingMailsSenders = example1@email.com;example2@email.com (separated by a semicolon)

I need to filter incoming emails with these two addresses, or more (in case if client wants to add some new conditions for new email senders in Config).

Using REF, so it will be something like Config(" IncommingMailsSenders")

How to filter unread emails from these specific senders with Filter in Get Outlook Mail messages ? Is it possible ? I can make some rules directly in outlook, and moving emails to new folder, but this way will be more elegant.

Thanks a lot and have a nice day

Jan Lemon

@jlemon

  1. Use Get Outlook Mail Message activity to read the mails from Outlook and it will give output as List of Mail Messages. Let’s say mailMessages.

  2. Read all sender mail ids from config file and assign it to variable of type array of string as below.

     arrEmails = Config(" IncommingMailsSenders").ToString.Split(";"c)
    
  3. And then use For Each loop activity to iterate one by one mail from list of mail messages.

      ForEach item in mailMessages
        If arrEmails.Contains(item.From.ToString)
           Then 
                Valid sender
            Else
                 Invalid sender
1 Like

Hi

Once after you read the mail I’d from config and saved it to a string variable named Strinput

Then use a assign activity like this

strmailid1 = Split(Strinput.ToString,”;”)(0).ToString.Trim

And another assign activity like this

strmailid2 = Split(Strinput.ToString,”;”)(1).ToString.Trim

Were both the variable are of type string

  1. Then use GET OUTLOOK MAIL activity and
    Mention this in Filter property

β€œ [SenderEmailAddress] = β€˜ β€œ +strmailid1.ToString+ β€œ β€˜ OR [SenderEmailAddress] = β€˜ β€œ +strmailid2.ToString+ β€œ β€˜ β€œ

This will filter the mailid you want

Hope this would help you resolve this

Cheers @jlemon

1 Like

@jlemon

Mention below value in Filter property of Get Outlook Mail Message activity.

β€œ[SenderEmailAddress] = β€˜"+Config("IncommingMailsSenders").ToString.Split(";"c)(0)+"’ OR [SenderEmailAddress] = '"+Config("IncommingMailsSenders").ToString.Split(";"c)(1)+"'"

1 Like