7
<?php
require_once('../class.phpmailer.php');
//include("../class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
iconv_set_encoding("internal_encoding", "UTF-8");
$mail = new PHPMailer();
$mail->CharSet = "utf8";
/*
$body = file_get_contents('contents.html');
$body = eregi_replace("[\]",'',$body);
*/
$mail->IsSMTP(); // telling the class to use SMTP
//$mail->Host = "mail.app-cpr.com"; // SMTP server
//$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "tls"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 25; // set the SMTP port for the GMAIL server
$mail->Username = "[email protected]"; // GMAIL username
$mail->Password = "xxxxxxxxxxx"; // GMAIL password
$mail->SetFrom('[email protected]', 'First Last');
$mail->AddReplyTo("[email protected]","First Last");
$mail->Subject = "ทดสอบ";
/*
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
*/
$mail->MsgHTML("ทดสอบ");
$address = "[email protected]";
$mail->AddAddress($address, "John Doe");
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>
전자 메일 보내기는 정상이지만 헤더에 문제가 있습니다.PHP 메일러 헤더 인코딩 관련 문제
제목 :. 'ทดสอบ
'
내가
함께하려고합니다 - php mail special characters utf8
- => $ 메일 -> 주제 = "??? = UTF-8 B"를 사용 base64_encode ($ 대상). "? =";
그러나 그것은 나를 위해 작동하지 않습니다. 헤더 코딩이 무엇인지 알 수 있으며이를 타이 언어에 맞게 풀 수 있습니까?
시도 $ 메일 -> CharSet는 = "UTF-8"; –