I am trying to extract email from an email body.
The sample mail body is as below.
Status: Price Too High
Message: Test Message
I want to copy each as a separate Colum in excel.
expected output in excel
Email Status Message
firstname.lastname@example.org Price Too High Test Message
You can write Regex for extracting the Email, Status, Message as below
Create a variable for Mail body like MailBody = Item.Body.ToString
Create a variable as EmailAddress and Write Regex as below for Email
EmailAddress = system.text.regularexpressions.regex.Matches(MailBody, “(?<=Email:).+”)
This will extract the email address likewise write for remaining
And use Add datarow activity to write back to the datatable
Hope this will help you
Cannot assign from type ‘System.Text.RegularExpressions.MatchCollection’ to type ‘System.String’ in Assign activity ‘Assign’.
I am getting an error like this
Can you share the screenshot of your workflow?
the error is gone.
the actual mail body is also attached
mail body.txt (1.4 KB)
Help is appreciated.
Also have a look here:
Also working with your txt file content:
Please mark as solution and close this thread if this helps, so that others can benefit from this