Copy link to clipboard
Copied
Hi,
This my problem,
I find a PHP script who let me able to create a form mail in flash. User enter informations in a flash form and after the form communicate with this php page:
<?php
$sendTo = "need@help.com";
$subject = "Un message de votre site Web";
$headers = "From: MESSAGE <need@help.com>\r\n";
$headers .= "Reply-To: " . $_POST["item4"] . "\r\n";
$headers .= "Return-path: " . $_POST["item4"];
$item1 = mb_convert_encoding($item1 ,"iso-8859-9","utf-8");
$item1 = $_POST["item1"];
$item3 = mb_convert_encoding($item3 ,"iso-8859-9","utf-8");
$item3 = $_POST["item3"];
$item4 = mb_convert_encoding($item4 ,"iso-8859-9","utf-8");
$item4 = $_POST["item4"];
$item6 = mb_convert_encoding($item6 ,"iso-8859-9","utf-8");
$item6 = $_POST["item6"];
$item7 = mb_convert_encoding($item7 ,"iso-8859-9","utf-8");
$item7 = $_POST["item7"];
$scevap = mb_convert_encoding($scevap, "iso-8859-9", "utf-8");
$scevap = $_POST["scevap"];
$body = "Nom ou Entreprise : $item1 \nE-mail : $item4 \nTelephone : $item3 \nRace de chien : $item6 \n\nMESSAGE : \n$item7 ";
$message =stripslashes($message);
mail($sendTo , $subject , $body , $headers);
?>
then I receive perfectly the message in my mail box but accent caracter like Ć© ' Ć ect ... doesn't work, they are replaced by strange caracter.
Somebody have an idea of what I have to do to see accent perfectly ?
Thanks for everybody who will help me !
Your PHP script is attempting to convert from utf-8 encoding to iso-8859-9, but everything is the wrong way round. For example:
$item1 = mb_convert_encoding($item1 ,"iso-8859-9","utf-8");
$item1 = $_POST["item1"];
$item1 doesn't exist at the time you're trying to convert it. For it to work, the lines need to be the other way round:
$item1 = $_POST["item1"];
$item1 = mb_convert_encoding($item1 ,"iso-8859-9","utf-8");
However, it's not necessary to convert from UTF-8. Simply make the email UTF-8 encoded
...Copy link to clipboard
Copied
Your PHP script is attempting to convert from utf-8 encoding to iso-8859-9, but everything is the wrong way round. For example:
$item1 = mb_convert_encoding($item1 ,"iso-8859-9","utf-8");
$item1 = $_POST["item1"];
$item1 doesn't exist at the time you're trying to convert it. For it to work, the lines need to be the other way round:
$item1 = $_POST["item1"];
$item1 = mb_convert_encoding($item1 ,"iso-8859-9","utf-8");
However, it's not necessary to convert from UTF-8. Simply make the email UTF-8 encoded. To do this, you need to add the encoding to the headers. However, your current script has a serious security flaw in it. You should never include an email address gathered from a form in the headers without first checking that it isn't attempting to inject a spam relaye into your email.
Change this section:
$headers = "From: MESSAGE <need@help.com>\r\n";
// include the email in the headers only if safe
if (!preg_match('/Content-Type:|Cc:|Bcc:/i', $_POST['item4'])) {
$headers .= "Reply-To: " . $_POST["item4"] . "\r\n";
$headers .= "Return-path: " . $_POST["item4"] . "\r\n";
}
// send the email as UTF-8 encoding
$headers .= 'Content-Type: text/plain; charset=utf-8';
Copy link to clipboard
Copied
You got it !
Thanks you very much ... it's very helpfull and appreciated !
Find more inspiration, events, and resources on the new Adobe Community
Explore Now