How to filer the mail address in get mail

I need to filter mail address I have 40+ mail address is there I want to read that mails only
then I need to read and hear again I need to filter the subject I can use if condition for that
Like Subject contains (“Update”) like this
Here I need to send mail if I do not get the mail from the filter mail ID I need to send mail to them

How to do this? please help @NIVED_NAMBIAR

how to give filter excepression
image

if I use filter expression I get this error
RemoteException wrapping MailKit.Net.Imap.ImapCommandException: The IMAP server replied to the ‘SEARCH’ command with a ‘BAD’ response: Could not parse command
at UiPath.Mail.Activities.GetMailActivity.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

I hope I will get a replay from you

Thanks
Chethan P

Hi @copy_writes

You can try in two ways

  1. Store the output of mails in get Outlook mail activitiy in mails variable.

Now use below assign query to filter mail containing subject as Update

mails = mails.AsEnumerable().Where(Function (mail) mail.Subject.ToString.Contains(“Update”)).ToList()

Other way is

In filter expression put the expression like this

“@SQL=” + “””” + “urn:schemas:httpmail:subject” + “””” + ” like ‘%Update%’”

I am not much sure with second way

But u can try that

Regards

Nived N :robot:

Happy Automation :relaxed::relaxed::relaxed:

1 Like

I have 40+ mail id is there from that mail id only I need to extract the body and I if it has update on that time we have to extract the body and place it in excel.

Hi @copy_writes

What u mean by update there ?

Subject contains update

Like the mails contains only filteres mail whose subject is mail

If there are multiple mails having subject as Update u can loop through each mails and use mail.body to retrive the body of mail and can append to datatable

Regards

Nived N :robot:

Happy Automation :relaxed::relaxed::relaxed:

1 Like

if we need to extract the body and the subject from that particular mails like Chethan@gmail cherry@gmail.com Upto 40+ mails are there on that time what we have to do

Hi @copy_writes

did u mean that extraction of mails from 40+ is slowing the automation process by using for each ?

yes and how extract that particular 40 mail.

Hi @copy_writes
You can write in FilterExpression property “SUBJECT Update”