Mail Message - Read body without html tags

email
activities

#1

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


#2

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.


#3

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?


#4

@trixy, Not sure if this is an best way to do. But atleast will give a try with this :smile:

  1. https://stackoverflow.com/questions/286813/how-do-you-convert-html-to-plain-text
  2. http://www.beansoftware.com/ASP.NET-Tutorials/Convert-HTML-To-Plain-Text.aspx

Regards,
Dom :slight_smile:


Writing the text after converting the html into the text form
#5

Hi, thanks :slight_smile:
This is what works for html in string format. (import system.text.regularexpressions)
52


#6

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


#7

Hi,
Did you find a way to read mail body as plain text ?
I am also facing this issue.


#8

Anyone able to resolve this issue. I am facing the same.