How to read the mails based on specified body content?

I need to read the outlook mails based on the specified body content.
For example: I am having the body content of the mail in outlook like.,

Client Id:*****

Only have to read above mentioned body content of the mails, can anyone guide me, How to read the mails ?
Thanks in advance.

@jamunatj Can you give a try on this Expression :
System.Text.RegularExpressions.Regex.Match(yourMail.Body.ToString,“(?<=Client Id:).*”).Value

Thanks for your reply @supermanPunch
where I have to use you have mentioned expression?

Main.xaml (4.2 KB)

I have tried based on subject,
In above mention xaml, I have provided filter properties as subject name like Details. Instead of “subject” filter in properties , How I have to filter through the above mentioned “body”.
Kindly guide me please.

@jamunatj Is the Filter Working Properly ? Are you able to only get mails of that particular subject ?

yes subject which i was provided in filter properties , working fine.
But I can able to only get mails of that particular “Body”.

System.Text.RegularExpressions.Regex.Match(yourMail.Body.ToString,“(?<=Client Id:).*”).Value
This one where i need to give and check ?

@jamunatj Check this Workflow, I have modified a bit :
Main.xaml (6.6 KB)

Thanks for your response @supermanPunch
I have tried your xaml but facing compiler error, which image i have mentioned below.

and also mail subject won’t be same always but your xaml file you have filtered from subject.
My requirement From different subject, I need to filter based particuler body of the mails only.( example body format I have mentioned above)

@jamunatj Can you check what is the Type argument of For Each, If it is not System.Net.MailMessage. Change it to that type.

Check this workflow, @jamunatj
Main (1).xaml (6.3 KB)
Hope this may help you :slight_smile:

1 Like

Thanks for your response @supermanPunch
Your xaml is working fine, In your script your are filtering from same subject but as per my requirement subject won’t be same.

@jamunatj Actually that was the Filter set by you :sweat_smile: , Can you tell us what are the Different Subjects that you want to extract email body from ?

We can alter the Filter for that purpose

Thanks for your response@Manish540
Your xaml is working fine but the body of the word “Client id” if it is in another mail means reading that mail also.It should not be read that mail.
Example body of the mail:

Client ID:*******

As per my requirement I have to read only this body of the mail and also subject wont be same for this body the mail but body always same like this only for mails.
kindly guide me please from as per your xaml file.

Yeah its set by me, Actually don’t have a idea because of that only, I have just tried from subject filter but subject wont be same for all mails and also,
whatever the subject from this same body we have to read that. we don’t have a idea of different subject name. will get whatever.
thanks for your response.

@jamunatj Can you tell me if there are any unique Keywords in that mail body so that we can separate those mails from other mails? Like the Word Version ? or any other Specific words that only those mails will be containing

This is Unique keywords in the body and also This is our body format for all mails.

Client ID:*******

Can you tell me how to add “year:” and “version:” also like “Client ID” in if condition of your xaml file.?

@jamunatj Can you check if this works :
Main.xaml (8.3 KB)

Thanks for your support @supermanPunch
Its is working.

1 Like