.PHP ファイルで POST メソッドを使用してフォームを作成していますが、電子メールを受信すると、アクセント付きの文字であるはずの奇妙な文字がたくさん含まれています。
次のようになります。
<?php
if(isset($_POST['mail'])) {
// CHANGE THE TWO LINES BELOW
$email_to = "alala@alala.com";
$email_subject = "lalala";
// validation expected data exists
if(!isset($_POST['nome']) ||
!isset($_POST['mail']) ||
!isset($_POST['site']) ||
!isset($_POST['autorizacao']) ||
!isset($_POST['banca']) ||
!isset($_POST['descricao']) ||
!isset($_POST['mesa'])) {
died('');
}
$nome = $_POST['nome']; // required
$mail = $_POST['mail']; // required
$telefone = $_POST['telefone']; // required
$site = $_POST['site']; // required
$autorizacao = $_POST['autorizacao']; // required
$banca = $_POST['banca']; // required
$descricao = $_POST['descricao']; // required
$mesa = $_POST['mesa']; // required
$sugestoes = $_POST['sugestoes']; // required
$email_message = "Inscrição para a Showroom:.\n\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "Nome: ".clean_string($nome)."\n";
$email_message .= "E-mail: ".clean_string($mail)."\n";
$email_message .= "Email: ".clean_string($telefone)."\n";
$email_message .= "Email: ".clean_string($site)."\n";
$email_message .= "Email: ".clean_string($autorizacao)."\n";
$email_message .= "Email: ".clean_string($banca)."\n";
$email_message .= "Email: ".clean_string($descricao)."\n";
$email_message .= "Email: ".clean_string($mesa)."\n";
$email_message .= "Comments: ".clean_string($sugestoes)."\n";
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>