问题描述
我如何使html电子邮件与gmail / hotmail一样显示。
如果我只是回应它,它会影响整个页面布局。
我可以使用iframe,但肯定不是最好的解决方案
正如Marc B所说,我相信一个IFrame将是你最好的选择,但请注意,如果你只是转储任何电子邮件HTML代码,您有风险暴露自己的病毒,木马和恶意的HTML / JavaScript代码 - 您的电脑上打开潘多拉的盒子,除非您找到一个很好的方式来沙箱/剥离该HTML。
这是一个简单的Regex来清理JavaScript至少:
(?s)< script。* ?(/> |< / script>)
I'm building an PHP email mailbox script.
How would I make html emails display cleanly as they do in gmail/hotmail.
If I just echo it out it affects the whole page layout.
I could use iframes but surely that isn't the best solution.
As Marc B stated, I believe an IFrame would be your best bet... but please realize that if you just dump any email HTML code you risk exposing yourself to viruses, Trojans, and malicious HTML/JavaScript code - Your opening Pandora's box on your computer unless you find a good way to sandbox/strip that HTML.
Here's a simple Regex to clean JavaScript at least :
"(?s)<script.*?(/>|</script>)"
这篇关于PHP在HTML页面中显示html电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!