Distinguish emails

Hi,

I have 2 emails having subject

  1. Wires - date
  2. Wires _affiliate - date
    the spaces between may vary
    i need to perform 2 different set of actions for both email subject by using else if activity
    but how do i differentiate the emails?
    else if : item.subject.startswith(“Wires”) - by using this both emails got read in same sequence
    else if : item.subject.contains(“Affilate”)
    if : no emails received today

Can anyone please help

Hey @shilpashree.mohanty,

Try this condition in If Activity:

Else IF → Item.Subject.ToLower.Contains(“wires”) Andalso Item.Subject.ToLower.Contains(“affiliate”)

→ “All the activities related to Affiliate”

Else IF → Item.Subject.ToLower.Contains(“wires”) Andalso Not Item.Subject.ToLower.Contains(“affiliate”)

→ “All the activities related to Without Affiliate”

Else → No Mail Found

Cheers!

@shilpashree.mohanty,

You should be using Else If this way:

Sample code:
MailCompare.xaml (12.7 KB)

Thanks,
Ashok :slight_smile:

hello @Ajay_Mishra

as mentioned i need to use else if activity as i have 3 conditions

while using Item.Subject.ToLower.Contains(“wires”) Andalso not(Item.Subject.ToLower.Contains(“affiliate”)) and also item.attachment.any

its coming false so its not getting inside this sequence

used the same, but its not getting into the sequence & the conditions are inside for each loop

Hey @shilpashree.mohanty I have edited my solution please check!

Cheers!

@shilpashree.mohanty,

You should be combining subject checking conditions into one () and attachment check outside as it is.

used but its coming as false

tried but not working

@shilpashree.mohanty Just Debug it!

I think 1st Iteration will be false, afterwards it will be true for another mail!

but i had both emails
it did for 1, for other it came out of loop
i want as both conditions satisfy, both conditions should work

@shilpashree.mohanty,

Use this solution:

Sample code:
MailCompare.xaml (17.1 KB)

Output:
image

Thanks,
Ashok :slight_smile:

@shilpashree.mohanty Can you specify For which one it worked?
(check affiliate spelling correctly!)

Regards,
Ajay Mishra

is it possible for you to copy paste the conditions
my organization doesnt allow to download software and hence unable to open xamls

@shilpashree.mohanty ,

Here you go

(strMailSubject.ToLower.StartsWith("wires") And strMailSubject.ToLower.Contains("affiliate")) and item.Attachments.Count > 0

(strMailSubject.ToLower.StartsWith("wires") And Not strMailSubject.ToLower.Contains("affiliate")) and item.Attachments.Count > 0

@shilpashree.mohanty Can you provide us exact subject line?

Used this way, still not getting into the first block while i have both emails in mail box

image

posted the images below

@shilpashree.mohanty,

I hope there are attachments.

Hey @shilpashree.mohanty Just switch the conditions,

Firstly put item.Subject.Contains(“Afiliate”) and item.Attachments.Any

and put related activities in this block

then in 2nd Else If put 1st Condition

Hope this will resolve your issue!