PHP TinyMCE email snaffuu

Attached is a screenshot of an email that's generated from the following code:

$the_name=stripslashes($_POST['name']);
$the_comment = stripslashes($_POST['body']);
$the_comment = str_replace("<P>", "\r\n", "$the_comment");
$the_comment = str_replace("</P>", "", "$the_comment");
$to = "prayer@trinityspringhill.org";
$subject = "prayer request";
$message = "$the_name emailed you with the following prayer request:\n\n$the_comment";
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers = "From: prayer@trinityspringhill.org\r\n" ."X-Mailer: php";
 if (!mail($to, $subject, $message, $headers)) {
echo("<p>Message delivery failed...</p>");
}

I'm having a hard time eliminating the <P> garbage. I've tried html_entity_decode and anything else I can think of to no avail.

The tinymce dynamic has been a blessing and a problem in the way it insert line breaks, but surely there's a way to prevent these characters from showing up on the email.

What am I missing?
brucegustPHP DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
Try using str_ireplace() which is case in-sensitive instead of str_replace which is case sensitive.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ray PaseurCommented:
Consider also strip_tags() and nl2br() -- the answer is in there somewhere if you experiment with the text and the TinyMCE rendering.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.