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


#1

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


#2

Is there a question in there? :stuck_out_tongue:


#3

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


#4

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


#5

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.


#6

Process_Email.xaml (7.1 KB)

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


#7

Check this, use string split

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


#8

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?


#9

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.


#10

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


#11
[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


#12

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


#13

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.


#14

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)


#15

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.


#16

this error i am getting


#17

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


#18

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?


#19

Are you able to retrieve emails from Gmail?


#20

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?