Hello all,
I’m trying to read mails from gmail which is successful. However, when trying to read body of email using mail.Body as string, i see the body contains HTML tags. Is there a way to read email body as plain text?
TIA
Vishnu
Hello all,
I’m trying to read mails from gmail which is successful. However, when trying to read body of email using mail.Body as string, i see the body contains HTML tags. Is there a way to read email body as plain text?
TIA
Vishnu
I had a similar issue when sending emails and reading them again for an automation.
As I had control over the sending process here, I could use the “Format Text” option in outlook to turn off HTML formatting, when composing a message. This helps to receive the message in plain text format which can be read by UiPath.
Do you have control over the sending process here?.
There is another post in the forum which deals with HTML formatting - isBodyHtml not working as expected.
Please check if it provides any hints to you.
Hi I am thinking the same thing… I am reading email messages with IMAP, and the mailmessages are written in html. What is the best way to parse html so that the only thing left is the plain text?
@trixy, Not sure if this is an best way to do. But atleast will give a try with this
Regards,
Dom
Hi, thanks
This is what works for html in string format. (import system.text.regularexpressions)
Hi Trixy ,
what are you wrote that code is I tried but it is not working. it is showing with Html Tags.
Any one Provide answer
Hi,
Did you find a way to read mail body as plain text ?
I am also facing this issue.
Anyone able to resolve this issue. I am facing the same.
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.
Hi
Do you perhaps have a workflow for the “First Replace br , div , tr tags with Enviornment.Newline”, not sure how to accomplish this.
Thanks
yourStringHere.replace(“br”,“Environment.newline”)
repeat for div, tr etc…
Does Regex function need an import? I get an error that “Regex” is not declared - so it’s not recognizing it as a class function
OK, never mind, ofc you need to download the namespace