Get An Email address from a user Registration Details and send an outloook mail

Hi all, I have a registration details sent to me by an administrator, the details contain the email address of the registrant whom I will send an outlook email, the problem is how to get the email address from the outlook mail and send a message to that user email address.Please assist

So basically you are getting that sender email address in a body?

You can get the Body of receiving email, and filter that message only to extract email, then use that Email to send a message.

Could you share example of how this message that you receive looks like?

Yes, this is the body;

Dear Sir/Madam,

Thank you for registering. Your information is as follow:

Subscriber ID:

First Name: Collins

Last Name: Anthony

Email (UserID):


You can use this Regex expression in Matches activity:

In Matches activity you have
-Input (this will be the body of email)
-Pattern (this will be pattern from the link)
-Result (create the result named RegexResults with ctrl+K)

After that use Assign activity to assign some variable, lets say eMail with
eMail = RegexResult(0).Value


I have this match (?<=Email (UserID):).*.How do you want me to assign this

Cos I didn’t get this part: eMail = RegexResult(0).Value

RPAbotDev.xaml (4.8 KB)

Here you go, hope it clarify what I want to say :slight_smile:

Please resend, missing activity

Are you there?

1 Like

I am here now.

RPAbotDev.xaml (4.9 KB)

Try it now. Its the Matches activity

1 Like

@srdjan.suc, thanks for the info, the message box is displaying the same email each time I run and I have different emails. How do I change it so it can run other emails

you need to change the value of email variable, because the value that I typed into is static

1 Like

Thanks @srdjan.suc, please I want to send the mail and included it as this
but got the error message that outlook does not recognize one or more names.How do I resolve it please

you don’t need .ToString since the .Value already returns you a String.

See maybe to use .Trim if there is some leading or trailing spaces, maybe that is causing the issue.

What do you get in the message box above?

how do I remove the second part

You can split the string on the space

RegexResult(0).Value.Split(" "C) then store that in StringArray, and use StringArray(0) in “TO”

I did the assign but got the error “cannot assign from type system.object to type system.string