Getting HTML Mail Body

Dear community

I’m trying to extract a HTML-E-Mail body (specifically a table). I could use the row identificator (let’s say “Order1”) for the matches-Expression, apart from that, there is no delimiting text between the different rows. Any suggestions how to solve this issue?

Many thanks

from what i understand, you are trying to read a html table? you could try to pass the table to an XMLDocument object which will structure the data by tags. eventually you could also use string manipulation (ie. split the string by row tag: “”, “”

just some thoughts…

Hi

thanks for your response. I guess, that would work. I just have the issue with the assign-function (mailBody (new variable type XmlDocument) with the message.Body (type String).

“Cannot be converted to XmlDocument”… any Ideas?

Hi

I have now my StreamReader-Variable initialized and I’m able to get the body of the e-mail with the HTML-tags. It does look like further down below. How could I now split according to specific pattern? Any ideas? (I know, Microsoft HTML-Mails are a nightmare - but for testing purposes, it’s good enough…).html-mail.html (11.6 KB)

I noticed the html contains custom namespaces hence you will have to use an XMLNamespaceManager which might be tricky.

After looking at this, probably the easiest way is to save the mail content as html file (somewhere in a temporary location), open the file in internet explorer and use the Data Scraping activity to pull the table contents.
I would recommend this approach despite a slight more processing time.

I currently abandoned the idea of using the ugly HTML-Mail Format since it was only a temporary implementation. I however would have done it in the end by simply using “split” according to recurring patterns.

@binaer If you want to read mail body in HTML format you can use
mailMessage.Header("“HTMLBody”).ToString

13 Likes

Can you share the code? I have similar situation with you

4 Likes