Email validation failed: Email body is comprised of invalid HTML.

Su522
Kilo Sage

Can someone please help?

When using Flow Designer OOB action (spoke) "Send Email"

we are receiving the following error:

Email validation failed: Email body is comprised of invalid HTML.

 

Which prevents the email from being sent.

 

We tried creating an Action with the Input of the Body Text as a String 

And a Script Step with this code from another Community Post:

(function execute(inputs, outputs) {  
// Input variable
 var htmlString = inputs.text_IN;

// Remove HTML tags using regular expressions
var cleanString = htmlString.replace(/[<>]/g, '');

// Output variable
outputs.text_out = cleanString;
 
})(inputs, outputs);

 

The output is of type String

But this does not work, it errors with the following message

Error: The undefined value has no properties.,Detail: The undefined value has no properties.

 

How can we resolve this issue so we no longer get the error:

Email validation failed: Email body is comprised of invalid HTML.

and our "Send Email" action in the flow works?

 

Help is greatly appreciated!!!

Thank you

 

1 ACCEPTED SOLUTION

Su522
Kilo Sage

Clean HTML- Flow Designer Action

Create a FD Action with Input:

Su522_0-1726248276076.png

 

Script Step:

Su522_1-1726248276078.png

 

Script:

(function execute(inputs, outputs) {  

 

// Input variable

  var htmlString = inputs.htmlString;

 

// Remove HTML tags using regular expressions

var cleanString = htmlString.replace(/<br ?\/?>|<\/p>/ig, "\n");

cleanString = cleanString.replace(/<script[^>]+>.*<\/script>/ig);

cleanString = cleanString.replace(/<style[^>]+>.*<\/style>/ig);

cleanString = cleanString.replace(/<[^>]+>/g, "");

 

// Output variable

outputs.text_out = cleanString;

 

})(inputs, outputs);

 

Su522_2-1726248276079.png

 

Create Action Output:

Su522_3-1726248276081.png

 

Su522_4-1726248276081.png

 

Call the FD Action from the FD Flow:

(this will get the latest email response)

Su522_5-1726248276083.png

View solution in original post

3 REPLIES 3

Su522
Kilo Sage

Any help on this?

Su522
Kilo Sage

Clean HTML- Flow Designer Action

Create a FD Action with Input:

Su522_0-1726248276076.png

 

Script Step:

Su522_1-1726248276078.png

 

Script:

(function execute(inputs, outputs) {  

 

// Input variable

  var htmlString = inputs.htmlString;

 

// Remove HTML tags using regular expressions

var cleanString = htmlString.replace(/<br ?\/?>|<\/p>/ig, "\n");

cleanString = cleanString.replace(/<script[^>]+>.*<\/script>/ig);

cleanString = cleanString.replace(/<style[^>]+>.*<\/style>/ig);

cleanString = cleanString.replace(/<[^>]+>/g, "");

 

// Output variable

outputs.text_out = cleanString;

 

})(inputs, outputs);

 

Su522_2-1726248276079.png

 

Create Action Output:

Su522_3-1726248276081.png

 

Su522_4-1726248276081.png

 

Call the FD Action from the FD Flow:

(this will get the latest email response)

Su522_5-1726248276083.png

NayanM
Tera Contributor

Hi @Su522 ,

I am facing the same challenge in my flow as well. Can you please how you have added this new action in your flow ? Do we need to place it before the send email action in the flow designer ?

NayanM_0-1736168942723.png