How to open a link from an email that is running in the background?

Hello all, wish you all the best,

I am running an automation that goes through my Inbox and searches for specific characteristics e-mails, some of them have links that I need to open, those links are predecessed by “Click here to view Incident:” I tried to use clicks but if one of those exception e-mails that does not have the link appears the automation stops working, is there any way to do this in the background or something like that without using clicks from the general view tab of outlook thanks in advance.

Hello @goncalo.rocha
You can read the messages by using Get Text or read mail actvity, use regex to separate the Link and can open the link in an open browser activity.

System.Text.RegularExpressions.Regex.Match(YourString,"(?=http)[a-zA-Z0-9\S]+").Tostring.Trim

but can the get text activity be performed in the background without the email being open? I am not using any classic activities and the link is inbued as an hyperlink

Hi @goncalo.rocha ,

You would require to use Mail Activities to read the mail in the background. Depending upon how the email box is configured on your system, you will be using one of the activities provided by UiPath.
image

Most probably you would be able to achieve it by using the Get Outlook Mail Messages Activity. However, let us know if you are not able to use or get the expected output.

If you could I would go with get exchange mail. It runs in background and it doesnt require outlook. It is also faster then Outlook.

After receiving mail you could just get mailmessage.body and look for links just like in above solution. Then use links in open browser/use app activity.

I had a BOT working but my boss told me it was not fisable bcse i was taking the url’s to an excel and opening from there so if he had 200 emails it would be kinda dificult, so now i started from scratch and trying to use a for each, but if i go with clicks if a email apears that does not have that formatting he is expecting i get an error so i’m clueless on the best way to do it


part of the email where the hyperlink is like such
image

You have an error with setting up the folder in that activity. What is the error message? You can try replace that %20 with " " (space).

You can’t open a link in an automation that’s running in the background. Background automations do not have a UI, they cannot open applications (like the browser), and you can’t use UI activities like click. You don’t pass a URL to a click, you pass a UI element (or selector for a UI element).

@goncalo.rocha

Use get mail and then loop on emails and then get the body as html using the peoperties chekc box isblodybhtml or by using the mail.Headers(“HTMLBody”) and then extract the url using regex…please check below for regex…

Then you can use open browser/use application /browser activity to opwn the hyperlink you extracted

Cheers

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.