Link to home
Start Free TrialLog in
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?
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial