|  | 
	                
  
    | 
	 
        RE2 : <ยังไม่ได้เลยค่ะ> เขียนโปรแกรมส่งเมล์จาก contact us แล้วอีเมล์ที่ได้รับไม่แสดงภาษาไทย ช่วยหน่อยค่ะ     |  
    |  |  
 
	
		|  |  |  |  |  
		|  |  | 
          
            | พอดีว่าเขียนโปรแกรมหน้า contact us ส่งเข้าอีเมล์หลักได้เรียบร้อยแล้ว 
 แต่มาเจอปัญาหาคือ อีเมล์ที่ได้รับมา ไม่แสดงภาษาไทย
 
 ต้องไปแก้ตรงไหนค่ะ รบกวนพี่ ๆ ผู้รู้ช่วยหน่อยค่ะ
 
 Code (PHP)
 
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" /> 
<title>Sendemail Script</title>
</head>
<body>
<!-- Reminder: Add the link for the 'next page' (at the bottom) --> 
<!-- Reminder: Change 'YourEmail' to Your real email --> 
<?php
$ip = $_POST['ip']; 
$httpref = $_POST['httpref']; 
$httpagent = $_POST['httpagent']; 
//$visitor = $_POST['visitor']; //Your Name
//$visitormail = $_POST['visitormail']; //Your Email
//$notes = $_POST['notes'];//Mail Message
$name = $_POST['name'];
$address = $_POST['address'];
$f_email = $_POST['f_email'];
$phone = $_POST['phone'];
$subject = $_POST['subject'];
$notes = $_POST['notes'];
$verif_box = $_POST["verif_box"]; //verification image
// remove the backslashes that normally appears when entering " or ' 
//$notes = stripslashes($notes);  
//$visitor = stripslashes($visitor);  
//$visitormail = stripslashes($visitormail); 
$name = stripslashes($name);  
$address = stripslashes($address); 
$f_email = stripslashes($f_email);  
$phone = stripslashes($phone);  
$subject = stripslashes($subject); 
$notes = stripslashes($notes); 
// check to see if verificaton code was correct
if(md5($verif_box).'a4xn' == $_COOKIE['tntcon']){
	// if verification code was correct send the message and show this page
	echo "<script>alert('Send message already');window.location='../public_html/contact_us.php';</script>";
	//mail("[email protected]", 'Online Form: '.$visitor, $_SERVER['REMOTE_ADDR']."\n\n".$notes, "From: $visitormail");
	// delete the cookie so it cannot sent again by refreshing this page
	setcookie('tntcon','');
} else if(isset($notes) and $notes!=""){
	// if verification code was incorrect then return to contact page and show error
	echo "<script>alert('Please enter the correct code');window.location='../public_html/contact_us.php';</script>";
	exit;
	
} /*else {
	echo "no variables received, this page cannot be accessed directly";
	exit;
	}*/
 else if (eregi('http:', $notes)) {
die ("Do NOT try that! ! ");
}
	else if(!$f_email == "" && (!strstr($f_email,"@") || !strstr($f_email,"."))) {
echo "<h2>Use Back - Enter valid e-mail</h2>\n"; 
$badinput = "<h2>Feedback was NOT submitted</h2>\n";
echo $badinput;
die ("Go back! ! ");
}
	else if(empty($name) || empty($f_email) || empty($notes )) {
echo "<h2>Use Back - fill in all fields</h2>\n";
die ("Use back! ! "); 
}
$todayis = date("l, F j, Y, g:i a") ;
/*$attn = $attn ; 
$subject = $attn; */
$message = " From: $f_email\n
Additional Info : IP = $ip \n\n
Name : $name\n
Address : $address\n
Email : $f_email\n
Phone : $phone\n
Subject : $subject\n
Message : $notes \n 
";
//$todayis [EST] \n\n
$notes = stripcslashes($notes); 
$from = "From: $f_email\r\n";
mail("[email protected]", $subject, $message, $from);
?>
</body>
</html>
 
 
 Tag : PHP
 
 
 |  
            | 
 ประวัติการแก้ไข
 2010-08-03 10:11:06
 2010-08-06 11:22:03
 2010-08-06 14:40:56
 |  
            | 
              
                |  |  |  |  
                |  | 
                    
                      | Date :
                          2010-08-03 10:03:36 | By :
                          manowJP | View :
                          1282 | Reply :
                          8 |  |  |  
                |  |  |  |  |  
            |  |  
		            |  |  
		|  |  |  |  |  
  
    | 
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ลองดูนะ Code (PHP)
 
 $from = 'MIME-Version: 1.0' . "\r\n"; 
$from.= 'Content-type: text/html; charset=windows-874' . "\r\n"; 
$from.= "From: $f_email\r\n";
mail("[email protected]", $subject, $message, $from);
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2010-08-03 21:06:20 | By :
                            heng |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
 
        
          |  |  |  |  |  
          |  |  | 
            
              | @K'heng ; ขอบคุณนะค่ะ ได้ไปทำตาม code ที่ให้มาแล้ว ใน inbox สามารถอ่านภาษาไทยได้แล้วค่ะ....แต่!!! ตรงหัวเมล์อ่ะค่ะ มันยังเป็นภาษาต่างด้าว อ่านภาษาไทยไม่ได้อยู่เลยค่ะ
 
 
  
 @K' webmaster(mr.win) ; ขอบคุณนะค่ะ ได้ลองนำมาประยุกต์ใช้แล้วค่ะ แต่...ไม่ได้!!!! T^T
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2010-08-06 11:18:45 | By :
                            manowJP |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              |  
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2010-08-06 11:21:00 | By :
                            manowJP |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ใน $message ลองแทรก <meta http-equiv="Content-Type" content="text/html;charset=windows-874"/> ดูนะ เอาไว้บนสุด 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2010-08-06 12:19:10 | By :
                            heng |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ของผมใช้แบบนี้อ่ะครับ 
 Code (PHP)
 
 $header		 = "MIME-Version: 1.0\r\n";
$header		.= "Content-type: text/html; charset=UTF-8\r\n";
$header		.= "From: $email\r\n";
 
 |  
              | 
 ประวัติการแก้ไข
 2010-08-06 12:32:01
 2010-08-06 12:32:39
 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2010-08-06 12:31:23 | By :
                            Black_Hawk |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | @K'heng ; ลองแทรกแล้วค่ะ ลองหลายแบบมากกกกก แต่ที่หัวมันยังคงไม่แสดงภาษาไทยอยู่เลยค่ะ T____T 
 Code (PHP)
 
 $message = "<meta http-equiv='Content-Type' content='text/html; charset=windows-874'>
	Name : $name \n <br>
	Address : $address \n <br>
	Email : $f_email \n <br>
	Phone : $phone \n <br>
	Subject : $subject \n <br>
	Message : $notes \n <br>";
 
 กับ
 Code (PHP)
 
 $message ='Content-type: text/html; charset=windows-874';
	$message = "Name : $name \n <br>
	Address : $address \n <br>
	Email : $f_email \n <br>
	Phone : $phone \n <br>
	Subject : $subject \n <br>
	Message : $notes \n <br>";
 
 ตรงหัวชื่อข้อความ ในส่วนของ subject ก็ยังไม่แสดงภาษาไทยเหมือนเดิม แต่ถ้าเป็นภาอังกฤษไม่มีปัญหาอะไร ปกติ
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2010-08-06 14:52:11 | By :
                            manowJP |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ^____^ ขอบคุณทุกคนค่ะ ได้แล้วค่ะ ไปแก้ที่ฟอร์ม contact us เปลี่ยนค่า charset=windows-874 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2010-08-06 15:30:01 | By :
                            manowJP |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  |  |