Reading keywords from a mail body say "translate" and pick up the value "Dutch"

Reading keywords from a mail body say “translate” and pick up the value “Dutch”.
Then pick up the “URL” value say ''www.wikipedia.com"
Read the first sentence in the wikipedia page and translate it to Dutch using google translator

Is there a question in there? :stuck_out_tongue:

if you have a formatted email body with Key value saperated by a delimiter,it would be easy to extract the data.

Getoutlookemails activity>Read Body & store in Variables>Using webscraping open wiki and read 1st sentence>using Google Text Translate Activity translate it to dutch

I think you need to install Uipath Cognitive Activities package for translate

Any person sends an e-mail to the email address ‘robot@gmail.com’ with the following Subject “Translate”
Mail Body
Dear Robot,
Could you be so kind as to translate the [number] sentence of the website [website] into [language]. And please send this to [email address].

Thank you,
Any Person
The robot finds the keyword “translate” in the subject of the mail. Then invokes Process Email workflow and copies the message. Now I need to pick up the below values from the message body
o [number]: a numerical value.
o [website]: an URL
o [language]: a language stated in English
o [email address]: an email address
o Go to website [website] homepage.
o Find [number]th sentence and copy this sentence.
o Go to Google Translate and have the sentence translated. Copy the translation.
o Send a mail (from where?, with what added texts?) with the translation to [email address].
o Send a mail (what text) to the requester to inform that the request has been executed.

I am new to UIPath so wondering how can I pick up those values from the Message body

One solution is,

you can load the email body into a streamreader and in foreach loop read each line and search for keywords. if the keyword is found, store the value in a variable. Hope it helps.

Process_Email.xaml (7.1 KB)

Can you just check and say if you were suggesting something similar?

1 Like

Check this, use string split

strBody.Split({VbCr, VbLf, VbCrLf}, StringSplitOptions.RemoveEmptyEntries)

1 Like

Thanks for your quick response. I will make the changes and share the updated xaml file. But one thing
4 variables say reader1(translate to) , reader2(url),reader3,reader4 to store the values inside them do I need to do simply reader1.ReadToEnd ??? similarly for reader2… and once the values are stored how do I use them in web recording?

Dont use reader, spilt the string and use String Arrary (string ) and iterate it in foreach loop.

each item(string) will give you one line, split that line using the delimter (colon you have in ur email body) and substring.Get value inside a variable.

for recording check below link.

Hope it helps.

split that line using the delimter (colon you have in ur email body) and substring.Get value inside a variable.”

Can u give an example

[number]: a numerical value.

o [website]: an URL
o [language]: a language stated in English
o [email address]: an email address

For above lines:

user Split(item.ToString,“:”) to get the values

Do I again need to run a foreach loop on varLanguage string = Split(item.ToString,“:”)?? or how do I do the substring.getvalue?

Yes, you need to use for each again.

If you think you cannot split a line ( remaining lines in the email body) , use substring for them.

Hi Vaidya,
I made some changes and updated the latest xaml’s. can you check them once?Process_Email.xaml (13.0 KB)
Mail_Trigger_Sample.xaml (19.6 KB)

Hey @I_robot Looks good to me, are you having any issues.

You could use trim to remove all leading and trailing white-space characters.

1 Like

this error i am getting

The above problem is resolved but now I see the robot got freezed in this state

I am invoking Process Email workflow from within the Mail Target Sample workflow.
I am passing the argument message body in a variable called “Body” whose scope is Main.

Now in the invoked workflow I have defined the same variable again this time with the scope Sequence. Should it be done differently?

Are you able to retrieve emails from Gmail?

This is the state where it freezes and when I check the mail I could see the mail has been read how do I check the for retrieved values from the mail?