I am storing a classic email template as HTML in an attribute called storedMessage. My target is to preview my classic email templates in a Lightning component. I used the following tag to render the stored email in the component:

<aura:attribute name="storedEmail" type="String" default="No preview"/>
<aura:unescapedHtml value="{!v.storedEmail}"/> 

It works fine, and I can preview the email; however, all the HTML content in aura:unescapedHtml is inheriting the styling of the Lightning component, so the preview looks weird.

My approach is to display the attributte storedEmail in an iframe, but the iframe in Lighting only supports src with an URL and not srcdoc, so I cannot display the content using my attribute storedEmail. My wo-worker advised me to create a visualforce page, maybe called emailContainerPage, and pass the HTML. In this way, I can use the iframe with src, something like:

<iframe src="{!'/apex/htmlContainerPage?html=' + v.storedEmail}"></iframe>

Is this the only solution for my issue or maybe there is another easy way using aura:unescapedHtml or other Lightning feature?

1 Answer 1


Lightning Web Components don't inherit the style from a parent, so include your html text in a LWC and then place the LWC in the original lightning aura component/application.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .