צפיות
תשובות
שליחת מייל מפלאש דרך PHP בעברית יוצא כ"?".
שלום, אני מנסה לבנות מעיין הנפשת פלאש (בפלאש 8) אשר תשלח לקובץ PHP את המידע המוזן אליה והמידע ישלח דרך הקובץ אל המייל
הנה קוד הAC
stop();
System.useCodepage = true;
sendmail.onRelease = function() {
form_varbls = new LoadVars();
form_varbls.email = email.text;
form_varbls.namess = namess.text;
form_varbls.subject = subject.text;
form_varbls.message = message.text+" "+phone.text+" "+adress.text;
if (form_varbls.email != "" and form_varbls.subject != "" and form_varbls.namess != "" and form_varbls.message != "")
{
trace(namess.text);
form_varbls.sendAndLoad("sendmail.php?", form_varbls, "POST");
gotoAndPlay(2);
} else {
gotoAndStop(1);
}
form_varbls.onLoad = function() {
gotoAndStop(51);
והנה קוד הPHP
<?php
$headers = 'MIME-Version: 1.0' . "rn";
$headers .="Content-type: text/plain; charset=utf-8; rn";
$name=$_GET['namess'];
$email=$_GET[’email'];
$subject=$_GET['subject'];
$message=$_GET['message'];
//set the email id below
$to="[email protected]";
// To send HTML mail, the Content-type header must be set
echo $message;
echo $subject;
// Additional headers
$headers .= 'To: Info <[email protected]>' . "rn";
$headers .= 'From: '.$_POST['namess'].' <'.$_POST[’email'].'>' . "rn";
mail($to,$subject,$message,$headers);
?>
הבעיה היא שכל דבר בשפה העברית נשלח כסימני שאלה.
1 תשובות
אני לא מכיר את PHP אבל יכול להציע 2 דברים לבדיקה:
קודם כל תבדוק שהמידע מגיע מהפלאש תקין, ואת זה תוכל לעשות ע"י הדפסת המידע למסך עוד לפני שנשלח במייל, בקובץ PHP עצמו
ושנית אני מציע שתוודא שהקובץ עצמו מקודד ביוניקוד. כשאתה שומר את קובץ ה-PHP אמור להיות לך אפשרות לקידוד הטופס, וזה צריך להיות גם כן UTF8