Mail.subject.contains doesn't auto-complete

Hi Lincon

Sorry to be a pain - I have to urgently complete a task by 4pm today and have wasted about 12 hours trying to solve this.

Could you please tell me why I can not find the action mail.subject.contains?
Is there a package that I need to install?

I have tried reinstalling Uipath but I think that it remembers what I have installed before. As the first time I had it available and I must have messed up my configuration.

Thank you in advance for any assistance.



Hi Aaron,

Sorry for the late reply. I’m a new user so I couldn’t reply anymore until my account was released from its restrictions.

If I’m understanding you correctly, it sounds like you have retrieved a list of mail messages and are looping through them possibly using a For Each activity. The syntax would be similar to For each item in Enter a VB expression.

Mail.Subject.contains is not an action or activity but more of a filter. In this case, if you were to leave the item as default, you could use item.subject.contains rather than mail.subject.contains since item/mail contains the individual record in the list of emails.

To call the function, you could do something like, item.subject.contains(“word to search for”).

Hi Lincon

Thank you for replying.

I will share with you the sample that I am trying to follow but the activity is not available to select in my installation. I am sure that there is a package that I have not installed.

Problem statement :- I need to identify emails with the subject containing Statements which have attachments.
Download and save the attachments to a folder and then extract the text from the PDF attachments.


I’m not sure if you’re looking for the text “Statements which have attachments” in the subject line or if you are looking for emails with attachments. In any case, you will need theUiPath.System.Activities package listed on the Project tab.

I have it expanded in the attached image.

If you have that, then you should be able to search for mail on the Activities tab.

The image above has the “Get Pop3 Mail Messages” activity added to the project panel. The output for the activity (in the project panel is set to MyEmails.

The Variable type is set to List


The item variable has to be changed to System.Net.Mail.MailMessage

I’ve added a Write Line Activity to the body of the for each loop.

This gives me a boolean (true/false) return value if it finds the text.

Perhaps this will get you a little further than where you were before. Let me know if you need more help and what has worked / not worked when you tried.

1 Like

Hi Lincoln

Just putting the little ones to bed.

Testing now. Thank you very much.

P.S. worked through the video. Nicely done. :slight_smile:

Will keep you informed.


I have the package Uipath.System.Activities installed and it shows under dependencies.

I still get a similar error with the type item.Subj…
It does not show up.???
Would you be able to skype so you can see what is happening?


Hi @aaron1

As previously mentioned by @Lincoln, you have to specify the type of the variable you will want to loop over, see here:

To do that:

  1. Go to the Properties panel on the right while having the For Each activity selected
  2. Update this field to match @Lincoln example:

Then, the auto-complete feature should work without an issue.

1 Like

Hi @aaron1 ,

I hope all is well. I made a video for you to walk you through retrieving emails and using Mail.subject.contains though I think I used item.subject.contains.

I hope it helps you. Let me know if you need any other walk throughs.



When i use the below one, it returns a boolean value(False/True)

How can i print the subject that contains Welcome text?

Welcome to the UiPath Community @Subha_Sundara_moorthi!

.Contains will always return a boolean value, it means that statement is true or false

I assume you are trying to read subject and if ur contains Welcome word then printing it, right?

Use a if condition, in the condition mention that same condition you wrote, just remove the .ToString from end. and in then block, write item.Subject

Make sure you have the for loop property set correctly. The argument should be of Mail.Message type as shown above in your thread too.

1 Like

Thanks!! Solved

1 Like