caracteres no email via php
pessoal alguem pode ajudar...
quando envio os e-mails os caracteres com acento e cedilha ficam destruidos no e-mail, estou colocando as especificações para ler html mas não esta dando certo...tudo é enviado as tabelas as variaveis, tudo sai corretamente menos os caracteres.....eis o codigo abaixo.
$mensagem = "
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<title>Formulário de Inscrição</title>
<style type='text/css'>
<!--
.style1 {
font-family: Arial, Helvetica, sans-serif;;
font-size: 14px;
background:#CAE4FF;
}
.style5 {font-family: Arial, Helvetica, sans-serif; font-size: 14px; }
.style13 {font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; }
.style21 {font-size: 12px}
.style22 {font-family: Arial, Helvetica, sans-serif; font-size: 12px; }
.style23 {font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold color:#333333; }
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.style25 {
font-size: 11px;
font-style: italic;
font-weight: bold;
}
.style27 {font-family: Arial, Helvetica, sans-serif; font-weight: bold; color: #000000; font-size: 14px; }
-->
</style>
</head>
<body>
<table width='100%' border='0' align='center' cellpadding='2' cellspacing='0'>
<tr>
<td colspan='4' class='style1'><div align='center'>
<h3 align='center'>VAGAS</h3>
</div></td>
</tr>
<tr>
<td width='18%'> </td>
<td colspan='3'> </td>
</tr>
<td height='30px' colspan='4' class='style5'><table width='100%' cellspacing='0' cellpadding='0' height='30px'>
<tr>
<td><span class='style27'>Dados</span></td>
</tr>
</table></td>
</tr>
<tr>
<td class='style22'> </td>
<td colspan='3'> </td>
</tr>
<tr>
<td class='style23'>Nome:
</blockquote></td>
<td colspan='3'><span class='style21'>$nome</span></td>
</tr>
<tr>
<td class='style23'>Telefone:
</blockquote></td>
<td colspan='3'><span class='style21'>$fone</span></td>
</tr>
<tr>
<td class='style23'>E-mail:
</blockquote></td>
<td colspan='3'><span class='style21'>$email</span></td>
</tr>
<tr>
<td class='style23'>Codigo:
</blockquote></td>
<td colspan='3'><span class='style21'>$codigo</span></td>
</tr>
<tr>
<td class='style23'>Comentario:</td>
<td colspan='3' class='style22'>$comentario</td>
</tr>
</table>
</body>
</html>
";
//valido os emails
/*
if (!ereg("^([0-9,a-z,A-Z]+)(.,_)@(.,_,-).{2}([0-9,a-z,A-Z])?$", $email))/if (!eregi("^[a-z0-9_\.\-]+@[a-z0-9_\.\-][a-z0-9_\-]+\.[a-z]{2,4}$", $email)) {
{echo "<script>alert('Digite o E-MAIL CORRETAMENTE !!!');history.back();</script>"; die();}
}
$arquivo = isset($_FILES["arquivo"]) ? $_FILES["arquivo"] : FALSE;
if(file_exists($arquivo["tmp_name"]) and !empty($arquivo)){
$fp = fopen($_FILES["arquivo"]["tmp_name"],"rb");
$anexo = fread($fp,filesize($_FILES["arquivo"]["tmp_name"]));
$anexo = base64_encode($anexo);
fclose($fp);
$anexo = chunk_split($anexo);
$boundary = "XYZ-" . date("dmYis") . "-ZYX";
$mens = "--$boundary\n";
$mens .= "Content-Transfer-Encoding: 8bits\n";
$mens .= "Content-Type: text/html; charset=\"utf-8\"\n\n";
$mens .= "$mensagem\n";
$mens .= "--$boundary\n";
$mens .= "Content-Type: ".$arquivo["type"]."\n";
$mens .= "Content-Disposition: attachment; filename=\"".$arquivo["name"]."\"\n";
$mens .= "Content-Transfer-Encoding: base64\n\n";
$mens .= "$anexo\n";
$mens .= "--$boundary--\r\n";
$headers = "MIME-Version: 1.0\n";
$headers .= "From: \"$nome\" <$email>\r\n";
$headers .= "Content-type: multipart/mixed; boundary=\"$boundary\"\r\n";
$headers .= "$boundary\n";
//envia o email com o anexo
mail("modelo@empregosjp.com","Vaga ".$codigo,$mens,$headers);
echo"<script>
alert('Curriculo ENVIADO com Sucesso!');
document.location.href='../php/logout.php';
</script>";
}
//se não tiver anexo
else{
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: \"$nome\" <$email_from>\r\n";
//envia o email sem anexo
mail("modelo@empregosjp.com","Cadastro de Vagas",$mensagem, $headers);
{echo"<script>alert('Curriculo NÃO enviado!!!');history.back();</script>"; die();}
}
mais se eu coloco esse outro codigo tudo funciona,
$headers = "Content-Type: text/html; charset=UTF-8\n";
$headers .= "From: \"$nome\" <$email>\r\n";
$headers .="X-Mailer: PHP v".phpversion()."\n";
$headers .="Return-Path:<$email>\n";
$headers .="MIME-Version:1.0\n";
$mensagem = "<strong><font color=\"#990000\">Nome: </font></strong> $nome<br><br>";
$mensagem .= "<strong><font color=\"#990000\">E-mail: </font></strong> $email<br><br>";
$mensagem .= "<strong><font color=\"#990000\">Telefone: </font></strong> $fone<br><br>";
$mensagem .= "<strong><font color=\"#990000\">Assunto: </font></strong> $assunto<br><br>";
$mensagem .= "<strong><font color=\"#990000\">Menssagem: </font></strong> $msg<br><br>";
mail($para, $email ,$mensagem, $headers) or die('Erro ao enviar o email !');
alugem sabe informar...
Discussão (1)
Carregando comentários...