i am showing the emails on my website php page through gamil api the api give me the html of the mails this mail html distrube my wesbite page html i am using below code for the displaying the html of the emails

$doc = new DOMDocument();
$doc->loadHTML($body);
$yourText=$doc->saveHTML();
$body=$yourText;
$body=htmlspecialchars($body);
$body=trim(preg_replace("/\r?\n/", " ",$body));
echo html_entity_decode($body);

can anybody help me in solving the above issue

Recommended Answers

All 3 Replies

Member Avatar for LastMitch

can anybody help me in solving the above issue

The code looks fine to me. What is the issue?

And what exactly is the issue?

try using an iframe,.. not ideal, but that is all I can think of right now..

something like this

echo '<iframe>';
echo html_entity_decode($body);
echo '</iframe>';

seach google for iframe css to style the iframe..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.