HTML inside HTML affecting each other

I've looked around at some other suggestions for my problem and the main suggestion is just to use an iframe...

However! I don't want to use an iframe. Onto the question anyway:

Essentially, I'm making a web based email client for a University team project in PHP and am having some problems with HTML emails... after FINALLY getting emails processed properly I've been looking through a few emails and came across one and the background of the email affected the background colour on the body tag of the website...

I took a look at the original message body and it is just like a regular HTML file, the body tag in the email has some CSS styles on it (including the background colour) so from that somehow the body styles from the email are being applied to the body of my page...

Essentially, what I need to know is if there is any way other than using an iframe to stop the code from affecting anything outside the div that contains the message body...



I've actually pretty much figured this out, this might be helpful for other people, so!

I took more of an in depth look into how gmail does it... and they actually convert the body tag into a div tag...

$body = str_replace(array("<body ","</body>"),array("<div ","</div>"),$body);

I also used some regular expressions to remove the head, html and doctype sections from the email, I'm still looking into any side affects of doing this but so far through all the emails I've tested it with it's not affected anything! If anyone wants the regular expressions I'm using, just comment on here...

It might not be the most elegant of solutions, but it works it seems!

Need Your Help

Joomla custom query string login redirect

redirect login query-string joomla3.4

I am trying to find a way of creating a link to take a user to the /component/users/?view=login page, and then when they have logged in redirect them to a page that is different from the 'Login

Why does SVD result of Armadillo differ from NumPy?

c++ python numpy linear-algebra armadillo

In my Python code, I was computing SVD of some data using numpy.linalg.svd: