How to Click on multiple URL in Email Body

Hi All,

Have check all related threads in forum but unable to find solution for my issue. Please Help

Below is my flow:
Step 1: Read emails with subject contains “cpc”
Step 2: click on urls given in email body of email with subject “cpc”, to download reports

Matches Property:
Matches%20property

Email Body Format:

In addition to above,

  • Reading email with subject line is successfully, as i was able to download attachment with the subject line. However to click on the urls in mail body for downloading reports is not working :frowning:

@peachnam Extract links based on the keywords and open the the links using open borwser and download the report.

Thanks for the reply,

Now when i tried it, its taking the IEnumerable in the URL

Please share a sample on how to do it…

@peachnam you are using matches method, so output will be collections then you have to use for each to get each link. if you know you will get only one link per mail u can use match method instead of matches.

Hi…No Luck

It’s not even opening the browser…

Also, will receive more than one URL in the email

@peachnam Can print the links using write line and check whether you getting links from the email or not?

It is in IENumerable

Do I need to change the “Type Argument” in property of for each to System.collections.Generic.IENumerable? but what to select argument type for URL?

@peachnam With type arguement as object i am getting correct values. please check below workflow.

Test.xaml (9.6 KB)

Still not resolved.
Is the xaml to read URL? As the reg expression seems different.

@peachnam I am not reading any urls, just replicating the matches activity that’s all. Might be your regex pattern is wrong please check the regex pattern once.

First write whole mail using writeline and check how u getting links and based on that create the regex.

hmmm…not sure, have used following options. nothing changed

\S(http|https)\S

(http)\S*

((http[s]?):/)?/?([^:/\s]+)((/\w+)/)\S

@peachnam

Hi,

Getting pretty close :slight_smile:

when used mail.body - mail body was coming blank in output panel.

So I followed following to get the mail body in output panel:
Assigned a String Variable = mail.headers(“PlainText”).Tostring
and then, split string variable using array (using stringvariable.split(environment.newline.ToArray())

Output Panel:

But now, its amending characters to itself in Open Browser…I think it is the syntax issue in Matches activity…Please guide

URL Error

Ok,

Now when i used regexp as ((http[s]?):/)?/?([^:/\s]+)((/\w+)/)\S

  • It’s opening the 2nd url correctly, however for the first url - it is amending > at the end hence giving error

@peachnam use string.replace method and replace "< " with “”, if you are getting special symbols use replace for them also.

1 Like

Awesome…It worked!!!

Thanks Buddy!

1 Like

@Manjuts90 Hi, I missed to identify this earlier, actually the BOT is reading URLs in email body as below

When you see the data in my “Output Panel”, there are 2 sections in the email body: Open Call Data & Close Call Data. As in the actual email body there is supposed to be one direct URL within each section.

However now there is a duplicate url within each section which is showing within < >.

Now how do I let Open Browser ignore the duplicate URL which is showing within <> and open only the direct URL?

I understand, if i don’t use “Replace Activity” it will only download 2 reports as required…however i believe that wouldn’t be the right thing to do?

@peachnam If your thinking about duplicate url in the mail body, add all the urls in mail to list or array, and remove the duplicate values from the list.
if my understanding is not correct please let me know.