Remove HTML code in body of email

Hello,
How can i remove html codes in my output when i retrieve data from my email.


Thank you

Hi @Kuenzang

See these

Thanks,
Prankur

1 Like

I browse your suggestion but I didn’t get the solution as I am using IMAP not outlook activity, so can me suggest me more.
Thank you :slight_smile:

Have you tried the last one?

Try this one

Thanks,
Prankur

1 Like

Why is it not working in my case? I have tried same contain and its not working in my case. :frowning_face:
no1

1 Like

What is the issue it is showing? Also I am assuming that SenderBody is a String variable.

Can you try to have one regex variable and initialize it

regex = new System.Text.RegularExpressions.Regex

Then try to use your code

regex.Replace(SenderBody, "<.*?>", string.Empty)

Thanks,
Prankur

2 Likes

First Replace br , div , tr tags with Enviornment.Newline and then replace the string with Regex.Replace(msg.Body,"<.*?>",string.Empty)…This gives the plain text in correct format.

1 Like

What is variable type of regex, as it gives an error “Overload resolution failed because no accessible ‘New’ accepts this number of arguments”.

Variable type is mentioned in above post. Can you share your workflow?

Thanks,
Prankur

1 Like

I got through the problem, thank you so much.

1 Like

Thank you

1 Like

Hi,

Id like to be able to get the text inside an html element.
So go through the body find all text inside the ‘pre’ tag and save it in a string.

Hey Karthick,

Can you share with me an example .xaml for replacing div break and tr tags?

Hi Kuenzang,

please let me know as to how did that work…!im not able to resolve it:confused:

hey @AnithaH

use this within assign activity.

Convert.ToString(Regex.Replace(remove_html_string, “<[^>]+>|&nbsp”, string.Empty)).Replace("&#8203",string.Empty).Replace(“v:* {behavior:url(#default#VML);}”,string.Empty).Replace(“o:* {behavior:url(#default#VML);}”,string.Empty).Replace(“w:* {behavior:url(#default#VML);}”,string.empty).Replace(".shape {behavior:url(#default#VML);}",string.Empty)

4 Likes

hey @Mr.StarLord_AO its working…Awesome…!!! Thanks much!

1 Like

I didn t understand how can i use it in assign activity and how can i access the text of a specific balise

create a new string variable(new_mailBody) and assign the entire entire thing given below by replacing original_mailbody with mailmessage body.

3 Likes

thanks a lot , it works

Mr Star, works perfectly.
For some reason the other solution proposed in the topics here, having to do with replace “br”, div and tr with environment.newlines completely didn’t work for me…