[Resolvido] Posso mandar html via e-mail através do php?
Aparece a seguinte mensagem:
Parse error: syntax error, unexpected '<' in /home/meusite/www/site/form/tellafriend.php on line 68
Vou na linha 68 e vejo q o problema está no meu html, ñ q ele esteja errado, pois já testei, mas pq acho q o código php ñ aceita, gostaria de saber como faze para ele aceitar?
ai vai o código:
<?php
// This following statement must not be changed.
// Copyright (c) Michael Bloch and Taming The Beast.
// Tell-A-Friend script V 2.1 Updated September 19 2006
// Taming the Beast.net - http://www.tamingthebeast.net
// Free Web Marketing and Ecommerce Resources and Tools
// By using this script you agree to indemnify Taming the Beast
// from from any liability that might arise from its use.
// The preceding statement must not be changed.
if(count($_POST)) {
This part strips out nasty code that a malicious
person may try to inject into the form
foreach(array('fmail1','fmail2','fmail3','fmail4','email','name') as $key) $_POST[$key] = strip_tags($_POST[$key]);
if(!is_secure($_POST)) { die("Hackers begone");}
This part submits a notification to you when
the form is submitted
// Email address for copies to be sent to - change to suit
$emailto = "contato@meusite.com";
// Notification email subject text for copies
$esubject = "indicação";
// Email body text for notifications
$emailtext = "
$_POST[name] tem utilizado o formulário de recomendação usando um endereço $_POST[email]
As pessoas recomendadas foram:
$_POST[fmail1]
$_POST[fmail2]
$_POST[fmail3]
$_POST[fmail4]
A página recomendada foi:
$_POST[refurl]
";
This function sends the email to you
@mail("$emailto", $esubject, $emailtext, "De: $_POST[email]");
This part is the function for sending to recipients
// Page to display after successful submission
// Change the thankyou.htm to suit
$thankyoupage = "thankyou.htm";
// Subject line for the recommendation - change to suit
$tsubject = "Bizoo do(a) $_POST[name]";
// Change the text below for the email
// Be careful not to change anyt "$_POST[value]" bits
//Coisa do Bruno para deixar mais bonito
$ttext = "
<!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">](http://www.w3.org/1999/xhtml)
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Cadastro</title>
</head>
<body>
<table width="570" height="445" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01">
<tr>
<td colspan="4">
<img src="[http://www.meusite.com/site/form/images/index_01.jpg"](http://www.meusite.com/site/form/images/index_01.jpg) width="570" height="57" alt="" style="display:block"></td>
</tr>
<tr>
<td>
<img src="[http://www.meusite.com/site/form/images/index_02.jpg"](http://www.meusite.com/site/form/images/index_02.jpg) width="47" height="49" alt="" style="display:block" ></td>
<td width="473" height="49" colspan="2" bgcolor="#D3F00E" style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:18px; font-weight:bold; color:#5a5a5a">Lembra de uma pessoa chamada <br>
$_POST[name]?</td>
<td>
<img src="[http://www.meusite.com/site/form/images/index_04.jpg"](http://www.meusite.com/site/form/images/index_04.jpg) width="50" height="49" alt="" style="display:block" ></td>
</tr>
<tr>
<td>
<img src="[http://www.meusite.com/site/form/images/index_05.jpg"](http://www.meusite.com/site/form/images/index_05.jpg) width="47" height="173" alt="" style="display:block" ></td>
<td width="254" height="173" valign="top" bgcolor="#D3F00E" style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; color:#5a5a5a; padding-top:8px;"><p>Vou facilitar; ela atende pelo e-mail <strong>$_POST[email]</strong></p>
<p><strong>$_POST[name]</strong> deu uma passadinha no meusite.com e achou interessante <br>
um de nossos conteúdos e resolveu <br>
compartilhar com você.<br>
</p></td>
<td colspan="2">
<img src="[http://www.meusite.com/site/form/images/index_07.jpg"](http://www.meusite.com/site/form/images/index_07.jpg) width="269" height="173" alt="" style="display:block" ></td>
</tr>
<tr>
<td colspan="4">
<img src="[http://www.meusite.com/site/form/images/index_08.jpg"](http://www.meusite.com/site/form/images/index_08.jpg) width="570" height="9" alt="" style="display:block" ></td>
</tr>
<tr>
<td colspan="4">
<a href="$_POST[refurl]">
<img src="[http://www.meusite.com/site/form/images/EMAIL_CADASTRO_GRATUITO03_06.jpg"](http://www.meusite.com/site/form/images/EMAIL_CADASTRO_GRATUITO03_06.jpg) width="570" height="111" border="0" alt="" style="display:block" ></a></td>
</tr>
<tr>
<td colspan="4">
<img src="[http://www.meusite.com/site/form/images/index_10.jpg"](http://www.meusite.com/site/form/images/index_10.jpg) width="570" height="45" alt="" style="display:block" ></td>
</tr>
<tr>
<td>
<img src="[http://www.meusite.com/site/form/images/spacer.gif"](http://www.meusite.com/site/form/images/spacer.gif) width="47" height="1" alt="" style="display:block" ></td>
<td>
<img src="[http://www.meusite.com/site/form/images/spacer.gif"](http://www.meusite.com/site/form/images/spacer.gif) width="254" height="1" alt="" style="display:block" ></td>
<td>
<img src="[http://www.meusite.com/site/form/images/spacer.gif"](http://www.meusite.com/site/form/images/spacer.gif) width="219" height="1" alt="" style="display:block" ></td>
<td>
<img src="[http://www.meusite.com/site/form/images/spacer.gif"](http://www.meusite.com/site/form/images/spacer.gif) width="50" height="1" alt="" style="display:block" ></td>
</tr>
</table>
</body>
</html>
";
This sends the note to the addresses submitted
@mail("$_POST[fmail1],$_POST[fmail2],$_POST[fmail3],$_POST[fmail4]", $tsubject, $ttext, "FROM: $_POST[email]");After submission, the thank you page
header("Location: $thankyoupage");
exit;
}
Nothing further can be changed. Leave the below as is
function is_secure($ar) {
$reg = "/(Content-Type|Bcc|MIME-Version|Content-Transfer-Encoding)/i";
if(!is_array($ar)) { return preg_match($reg,$ar);}
$incoming = array_values_recursive($ar);
foreach($incoming as $k=>$v) if(preg_match($reg,$v)) return false;
return true;
}
function array_values_recursive($array) {
$arrayValues = array();
foreach ($array as $key=>$value) {
if (is_scalar($value) || is_resource($value)) {
$arrayValues[] = $value;
$arrayValues[] = $key;
}
elseif (is_array($value)) {
$arrayValues[] = $key;
$arrayValues = array_merge($arrayValues, array_values_recursive($value));
}
}
return $arrayValues;
}
?>
Desde já muito obrigado a todos!
Discussão (9)
Carregando comentários...