hi all,
i get automatic emails for new hires always in the same format. i just want to extract the email from the body. the thing is there are alot of other things on that email like replies on a single thread. i have seen someone say use regex but not sure how to do that. please someone give me clear and simple steps to get what i need. i then need to extract the email address and paste on excel sheet. below is a picture of the email.
First I hope you need only the email ID if so do the below.
Use get mail to get the mails and it will give you the body
now say body is stored in body variable then body.Split(“We have finished onboarding”,StringSplitOptions.None)(body.Split(“We have finished onboarding”,StringSplitOptions.None).Count-1)
Now the output of above can be stored in same body string
Now use Matches activity with the following regex ([\w.-]+)@([\w.-]+).([a-zA-Z]+) Store results in result
Result(0) is your email ID
cheers
thankyou for the response i will try this out. if you dont mind me asking how do you learn how to do regex for this.
Hey @Shazid_Rahman ,
You want to get the sender email address or the email address mentioned in the mail body.
-
In case if you want to get the email address of sender than you can use
EmailObject.From.ToAddress.ToString -
In case if you want to get the email mentioned in the email body than you can use
System.Text.RegularExpressions.Regex(EmailObject.Body,“(?<=Email:)\s.+”))
Try the above solutions and let me know if you are facing any issue.
Thanks,
Sanjit Pal
We try it and place in this site. Please try the same. Here you can write regex and also see what it does
cheers
yes i have tried to use this but not sure how to.
To begin with start reading on the right bottom what every expression does. Then dont directly jump into doing whole regex…try a small piece first and from there slowly include more string parts. You might not do it easily at first but you will definitely progress
Cheers
HI SIR i am having trouble with this can you please give me process
thankyou for responding can you make the template for doing this i just think i am using matches activity wrong can you show me
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.