Jump to content

Problem posting HTML tags


c_shelswell

Recommended Posts

Hi i'm trying to make a page that'll send html emails. I have phpmailer installed and working great but the bit i'm stuck at is i want to have a textarea where i user can paste a HTML email when it gets to the next page it'll take the html message and send it in an email. Everytime i post it though it seems to lose the HTML. I've tried "htmlspecialchars" but that obviously just cancels all the html out and sends the tags thru. Is there any php function that'll allow the html tags thru properly?

 

Here's my code:

 

$msg = $_POST['msg_body'];

$htmlBody = "<?xml version='1.0' encoding='iso-8859-1'?>
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>SIMPLEMINDS DOWNLOAD CENTRE</title>
</head>$msg";

$mailer->AddAddress('[email protected], 'Chris');

$mailer->Subject = 'This test';
$mailer->Body = ($htmlBody);
$mailer->isHTML(true); 

if(!$mailer->Send())
{
	echo 'There was a problem sending the mail';
}
else
{
	echo 'Mail sent';
}

 

any help would be great. Many thanks

Link to comment
https://forums.phpfreaks.com/topic/50115-problem-posting-html-tags/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.