cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
trand86
Level: Powered On

HTML to Text conversion problem

Hi all,

So I've been trying to set up a flow, at first successfully. The flow is triggered when an email is received (in a specific folder), and the format of the email body is essentially an HTML table, each row is field name followed by value. This actually comes from an Oracle based webform that we don't have access to.

 

In basic form the email would look like this:

 

First Name

TEST

Last Name

FORM

Who Are You?

Other

Phone Number

01223444555

Email Address

test.form@testform.com

Address

7 Test Street

City

Test City

Post Code

TS11 2TS

Company

Testing Co

Warranty Type

3 Year

Date of Purchase

04-05-2018

Date of Installation

08-05-2018

Product Code

TEST0002

Quantity

7

Batch Code

TESTBATCH001

Agreed to terms and conditions?

Commercial I have read and understand the terms and conditions

 

All data in this form is a test input so no worry of breaches.

 

My flow takes all of the field response values, ready to put into something like an Excel spreadsheet. I use a combination of indexing and substring to get those results - works great.

 

All of my tests were done by forwarding the email to myself, whereby the HTML to text converter connector handles the translation and removes the HTML coding, and successfully leaves the format of the email so all of the text sits on its own line.

 

I come to go live with the flow, and the original email that gets sent out causes the flow to fail. Investigating this, and testing once again, it appears that the first email that's sent out has completely different HTML coding than that of when it's being forwarded.

 

So I set up an email forwarding rule, to automatically forward myself an email, move to another folder and then the flow runs. This didn't work. For some reason, only manually forwarding the email successfully keeps the formatting of the text from HTML. Instead, it appears as one long paragraph which in turn causes the flow to fail.

 

Here's the text that comes from the flow when it's not working:

First NameTESTLast NameFORMWho Are You? OtherPhone Number01223444555Email Addresstest.form@testform.comAddress7 Test StreetCityTest CityPost CodeTS11 2TS CompanyTesting Co Warranty Type3 YearDate of Purchase04-05-2018Date of Installation08-05-2018Product CodeTEST0002Quantity7Batch CodeTESTBATCH001Agreed to terms and conditions?Commercial I have read and understand the terms and conditions

 

I'm not quite sure why the HTML to text converter is doing this to the body of the email that comes in, when manually forwarding the email keeps the format.

 

Any ideas? I actually have the HTML code saved in a notepad to compare them but I'm no HTML writer.

4 REPLIES 4
Super User
Super User

Re: HTML to Text conversion problem

For your best results, you'll likely want to parse the HTML to a SharePoint List, and then pull/manipulate the SharePoint List data to your liking.

I pull in tons of data from P6 which is an Oracle Datbase connection, and trying to manipulate the data directly is a nightmare. I find it much easier to pull it into a SharePoint list, and then do with it as I want. 

If you could provide an expanded screenshot of your Flow and steps, and of any detailed error messages you're receiving we could likely better assist you.

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

trand86
Level: Powered On

Re: HTML to Text conversion problem

Thanks for the reply.

 

At the moment I'm merely using "get email" as my test and a manual trigger.

 

I was using indexof and substring expressions to split the text up, like I said worked a charm on emails manually forwarded.

 

But the original email that comes from source, contains a body that looks like this:

 

<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta content="text/html; charset=utf-8"> </head> <body> <table border="0" cellpadding="1" cellspacing="5" style="width:80%"> <tbody> <tr> <td><strong>First Name</strong></td> <td>TEST</td> </tr> <tr> <td><strong>Last Name</strong></td> <td>FORM</td> </tr> <tr> <td><strong>Who Are You? </strong></td> <td>Other</td> </tr> <tr> <td><strong>Phone Number</strong></td> <td>01223444555</td> </tr> <tr> <td><strong>Email Address</strong></td> <td>test.form@testform.com</td> </tr> <tr> <td><strong>Address</strong></td> <td>7 Test Street</td> </tr> <tr> <td><strong>City</strong></td> <td>Test City</td> </tr> <tr> <td><strong>Post Code</strong></td> <td>TS11 2TS</td> </tr> <tr> <td><strong>Company</strong></td> <td>Testing Co </td> </tr> <tr> <td><strong>Warranty Type</strong></td> <td>3 Year</td> </tr> <tr> <td><strong>Date of Purchase</strong></td> <td>04-05-2018</td> </tr> <tr> <td><strong>Date of Installation</strong></td> <td>08-05-2018</td> </tr> <tr> <td><strong>Product Code</strong></td> <td>TEST0002</td> </tr> <tr> <td><strong>Quantity</strong></td> <td>7</td> </tr> <tr> <td><strong>Batch Code</strong></td> <td>TESTBATCH001</td> </tr> <tr> <td><strong>Agreed to terms and conditions?</strong></td> <td>Commercial I have read and understand the terms and conditions </td> </tr> </tbody> </table> <p>&nbsp;</p> </body> </html>

 

Whereas when I take the same email, and manually forward it to myself, extra HTML gets added (understandably so):

 

 

 

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style>
<!-- @font-face {font-family:"Cambria Math"} @font-face {font-family:Calibri} p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0cm; margin-bottom:.0001pt; font-size:11.0pt; font-family:"Calibri",sans-serif} a:link, span.MsoHyperlink {color:#0563C1; text-decoration:underline} a:visited, span.MsoHyperlinkFollowed {color:#954F72; text-decoration:underline} p.msonormal0, li.msonormal0, div.msonormal0 {margin-right:0cm; margin-left:0cm; font-size:11.0pt; font-family:"Calibri",sans-serif} span.EmailStyle18 {font-family:"Calibri",sans-serif; color:black} .MsoChpDefault {font-size:10.0pt; font-family:"Calibri",sans-serif} @Anonymous WordSection1 {margin:72.0pt 72.0pt 72.0pt 72.0pt} div.WordSection1 {} -->
</style>
</head>
<body lang="EN-GB" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="color:black">&nbsp;</span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:black">&nbsp;</span></p>
<p class="MsoNormal"><b><span style="color:black">Tom Randall</span></b><span style="color:black"><br> </span><span style="font-size:9.0pt; color:black">Systems &amp; IT Administrator<br> <b>T: </b>01243 833888<br> </span><b><span style="font-size:10.0pt; color:#001D68">JCC Lighting Products Ltd.</span></b><span style="font-size:10.0pt; color:#001D68"><br> </span><span style="font-size:9.0pt; color:black">www.jcc.co.uk <b>| </b>tom.randall@jcc.co.uk</span><span style="color:black"></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:black">&nbsp;</span></p>
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> no-reply@leviton.com &lt;no-reply@leviton.com&gt; <br> <b>Sent:</b> 03 June 2019 12:40<br> <b>To:</b> Price, Chris &lt;chris.price@jcc.co.uk&gt;; JCC Warranty &lt;warranty@jcc.co.uk&gt;; Randall, Tom &lt;tom.randall@leviton.com&gt;<br> <b>Subject:</b> Warranty Form Submission</span></p>
<p class="MsoNormal">&nbsp;</p>
<table class="MsoNormalTable" border="0" cellspacing="5" cellpadding="0" width="80%" style="width:80.0%">
<tbody>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><strong><span lang="EN-US" style="font-family:&quot;Calibri&quot;,sans-serif; color:windowtext">First Name</span></strong><span lang="EN-US" style="color:windowtext"></span></p>
</td>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><span lang="EN-US" style="color:windowtext">TEST</span></p>
</td>
</tr>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><strong><span lang="EN-US" style="font-family:&quot;Calibri&quot;,sans-serif; color:windowtext">Last Name</span></strong><span lang="EN-US" style="color:windowtext"></span></p>
</td>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><span lang="EN-US" style="color:windowtext">FORM</span></p>
</td>
</tr>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><strong><span lang="EN-US" style="font-family:&quot;Calibri&quot;,sans-serif; color:windowtext">Who Are You? </span></strong><span lang="EN-US" style="color:windowtext"></span></p>
</td>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><span lang="EN-US" style="color:windowtext">Other</span></p>
</td>
</tr>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><strong><span lang="EN-US" style="font-family:&quot;Calibri&quot;,sans-serif; color:windowtext">Phone Number</span></strong><span lang="EN-US" style="color:windowtext"></span></p>
</td>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><span lang="EN-US" style="color:windowtext">01223444555</span></p>
</td>
</tr>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><strong><span lang="EN-US" style="font-family:&quot;Calibri&quot;,sans-serif; color:windowtext">Email Address</span></strong><span lang="EN-US" style="color:windowtext"></span></p>
</td>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><span lang="EN-US" style="color:windowtext"><a href="mailto:test.form@testform.com">test.form@testform.com</a></span></p>
</td>
</tr>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><strong><span lang="EN-US" style="font-family:&quot;Calibri&quot;,sans-serif; color:windowtext">Address</span></strong><span lang="EN-US" style="color:windowtext"></span></p>
</td>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><span lang="EN-US" style="color:windowtext">7 Test Street</span></p>
</td>
</tr>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><strong><span lang="EN-US" style="font-family:&quot;Calibri&quot;,sans-serif; color:windowtext">City</span></strong><span lang="EN-US" style="color:windowtext"></span></p>
</td>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><span lang="EN-US" style="color:windowtext">Test City</span></p>
</td>
</tr>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><strong><span lang="EN-US" style="font-family:&quot;Calibri&quot;,sans-serif; color:windowtext">Post Code</span></strong><span lang="EN-US" style="color:windowtext"></span></p>
</td>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><span lang="EN-US" style="color:windowtext">TS11 2TS</span></p>
</td>
</tr>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><strong><span lang="EN-US" style="font-family:&quot;Calibri&quot;,sans-serif; color:windowtext">Company</span></strong><span lang="EN-US" style="color:windowtext"></span></p>
</td>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><span lang="EN-US" style="color:windowtext">Testing Co </span> </p>
</td>
</tr>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><strong><span lang="EN-US" style="font-family:&quot;Calibri&quot;,sans-serif; color:windowtext">Warranty Type</span></strong><span lang="EN-US" style="color:windowtext"></span></p>
</td>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><span lang="EN-US" style="color:windowtext">3 Year</span></p>
</td>
</tr>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><strong><span lang="EN-US" style="font-family:&quot;Calibri&quot;,sans-serif; color:windowtext">Date of Purchase</span></strong><span lang="EN-US" style="color:windowtext"></span></p>
</td>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><span lang="EN-US" style="color:windowtext">04-05-2018</span></p>
</td>
</tr>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><strong><span lang="EN-US" style="font-family:&quot;Calibri&quot;,sans-serif; color:windowtext">Date of Installation</span></strong><span lang="EN-US" style="color:windowtext"></span></p>
</td>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><span lang="EN-US" style="color:windowtext">08-05-2018</span></p>
</td>
</tr>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><strong><span lang="EN-US" style="font-family:&quot;Calibri&quot;,sans-serif; color:windowtext">Product Code</span></strong><span lang="EN-US" style="color:windowtext"></span></p>
</td>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><span lang="EN-US" style="color:windowtext">TEST0002</span></p>
</td>
</tr>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><strong><span lang="EN-US" style="font-family:&quot;Calibri&quot;,sans-serif; color:windowtext">Quantity</span></strong><span lang="EN-US" style="color:windowtext"></span></p>
</td>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><span lang="EN-US" style="color:windowtext">7</span></p>
</td>
</tr>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><strong><span lang="EN-US" style="font-family:&quot;Calibri&quot;,sans-serif; color:windowtext">Batch Code</span></strong><span lang="EN-US" style="color:windowtext"></span></p>
</td>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><span lang="EN-US" style="color:windowtext">TESTBATCH001</span></p>
</td>
</tr>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><strong><span lang="EN-US" style="font-family:&quot;Calibri&quot;,sans-serif; color:windowtext">Agreed to terms and conditions?</span></strong><span lang="EN-US" style="color:windowtext"></span></p>
</td>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><span lang="EN-US" style="color:windowtext">Commercial I have read and understand the terms and conditions </span></p>
</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
</div>
</body>
</html>

 

Apologies for the amount of HTML. The second pasted HTML actually works with the HTML to text action, and returns each line or form field on it's own line, followed by the form response, on it's own line.

 

The first pasted HTML code with the html to text action returns a long paragraph with no spaces or lines between the field names and responses.

 

Annoyingly, I don't have access to create sharepoint lists here, our organisation isn't using Sharepoint in such a manner currently.

 

Community Support Team
Community Support Team

Re: HTML to Text conversion problem

Hi @trand86 ,

 

From your description, it seems that you are trying to convert the email from HTML to text.

 

However, if the email is forwarded to a specific folder automatically using rules, the action “HTML to text” won’t work as expected. If the email forwarded to the specific folder manually, it works as expected.

 

I have made a test on my side, however, the return results of the both way are the same.

 

Could you share more details on the flow to help reproduce this issue?

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
trand86
Level: Powered On

Re: HTML to Text conversion problem

Hi all, been out of action for a while so catching up with my Flows.

@v-yamao-msftwhat I mean is that if an email arrives, and you manually hit forward in outlook (for example forward to yourself) then the HTML that gets returned in Flow has more HTML padding in it than if Flow picks up the email upon arrival - when this happens the HTML is very minimal and thus the HTML to Text Conversion misses out all the line breaks in the HTML.

 

I'm missing my original examples now so hard to show what I mean.

 

I have managed to get around the problem by re-writing all of my expressions to index all characters including those HTML characters. It's not ideal but it works.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 322 members 5,717 guests
Please welcome our newest community members: