Reading IMAP email body in plain text



Hi Three,

I am having trouble reading email body as plain text. I am using uiPath.Main.IMAP.Activities.GetIMAPMailMessage to read emails of my gmail account. Everything seems working file except the body which I read through Mail.Body gives me content with html tags.

Is there a direct way in uiPATH itself to get the readable text instead of html content of it?

Here is how I am trying to get email attachment and body…



Outlook mail activity gives you text directly without html tags @bantuk (or) You need to use this
Regex.Replace(item.Body, "<[^>]+>| ", string.Empty)


I can not use Outlook so second option I can go for. However this replace converts entire text into a single line text. :slightly_smiling_face:

I want to treat New Line separately. Is there a way to do that?

My text is like this:

Employee ID: 12345

Employee Name: John D

Group: RSR

Which becomes:

EmployeeID:12345Employee Name:JohnDGroup:RSR