PHP Mailer头编码的问题
发布时间:2020-12-13 18:12:41 所属栏目:PHP教程 来源:网络整理
导读:?phprequire_once('../class.phpmailer.php');//include("../class.smtp.php"); // optional,gets called from within class.phpmailer.php if not already loadediconv_set_encoding("internal_encoding","UTF-8");$mail = new PHPMailer();$mail-CharSet =
<?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 = "xxxxxxx@gmail.com"; // GMAIL username $mail->Password = "xxxxxxxxxxx"; // GMAIL password $mail->SetFrom('xxxxxxx@gmail.com','First Last'); $mail->AddReplyTo("xxxxxxx@gmail.com","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 = "xxxxxxx@gmail.com"; $mail->AddAddress($address,"John Doe"); if(!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "Message sent!"; } ?> 电子邮件发送正常,但标题有问题. 主题:’ทดสอบ’ 我会尝试 但它对我不起作用.我怎么知道标题编码是什么,并在我的泰语语言中解决这个问题?
使用
$mail->CharSet = 'UTF-8'; 代替 $mail->CharSet = "utf8"; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |