Flow design giving Email validation failed: Email body is comprised of invalid HTML. error

Community Alums
Not applicable

I've created a flow that has an action to pull the emails from sys_email table.  The Action is working perfectly but when I try to add the information to  the Email in the Flow I'm getting the following error:

Email validation failed: Email body is comprised of invalid HTML.
 
I have trimmed all of the HTML out of the Action but I'm still getting this error. 
Has anyone had this and know how to get it to render correctly?
 
thanks
1 ACCEPTED SOLUTION

Community Alums
Not applicable

I figured it out,  I put some regex in there to strip out the unwanted HTML code that was causing the problem <head></head><html></html><body></body>. 

Works great now.

View solution in original post

12 REPLIES 12

Afsar2
Tera Contributor

I was facing similar error while adding email body(inbound) to a email notification.

Invalid HTML error goes away with user of reqExp on email.body_text.

 

var htmlRegexG = /<(?:"[^"]*"['"]*|'[^']*'['"]*|[^'">])+>/g;
email.body_text.replace(htmlRegexG, '');

reference  

Hi, I'm facing the same issue as Stephen, could you please tell me in what exact part do yo put this code in flow designer?

 

Thanks in advance!

Regards.

duydo
Tera Contributor

Not sure if this will help others..

I set flow variable of string type with script.

var htmlRegexG = /<(?:"[^"]*"['"]*|'[^']*'['"]*|[^'">])+>/g;
fd_data.trigger.body_text.replace(htmlRegexG, '');
 
And then use the variable in the Send Email action