How to display html email address in browser without changing my bg colors and changing table

In the new application that I am creating, I want to display the html email address in a table in a browser.

The problem is that html emails change the background color on my web page and sometimes end up with the html table that I use to display multiple emails.

Typically, emails contain full html, body, div, and table tags. A common occurrence is the body of bgcolor "ff0000", which turns my entire application into red.

Is there a way to deal with this, or should I encode it to take out the html tags.

Also, I tried to show the email code in an iframe, but to no avail. it didn't actually display the code at all, just an empty iframe.

<iframe>Body of html email here</iframe>

I am sure that I am missing something simple - any help would be appreciated.

Btw, html email is stored in php string.

+3
source share
5 answers

what you can do is use javascript to embed the HTML email in iFrame. The reason it changes your background is because you have global styles in your email stylesheet and they apply to the rest of the page.

$('#loader_frame')[0].contentDocument.body.innerHTML = YOUR HTML
+4
source

Content inside the tag is displayed if the browser does not support iframes. To use iframes properly, you must set the src attribute: 1

<iframe src ="html_intro.asp" width="100%" height="300">
  <p>Your browser does not support iframes.</p>
</iframe>

src URL-, . :

<iframe src="getemail.php?id=12345" width="100%" height="300"></iframe>

getemail.php script html, .

+3

chrome, css , css

0

iframe HTML- iframe src.

, , html body. .

Another thing to try is to ensure that your styles from the parent page always take precedence.

to try

body { background:lightgreen !important; /* important will override styles that come later with the same specificity */ }
0
source

In this case, I would use an iframe - the problem is that you are using it incorrectly (the code in the tags is backup for older browsers):

<iframe src="yoursite.com/youremail.html" width="600" height="600" name="emailFrame">
  <p>Sorry, your Browser can't display iFrames</p>
</iframe>
0
source

Source: https://habr.com/ru/post/1770461/


All Articles