Avatar of Bruce Gust
Bruce GustFlag for United States of America

asked on 

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?
PHP

Avatar of undefined
Last Comment
Ray Paseur
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
PHP
PHP

PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.

125K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo