我把phpmailer对象输出
object(PHPMailer)#8 (57) {
  ["Priority"] => int(3)
  ["CharSet"] => string(5) "utf-8"
  ["ContentType"] => string(9) "text/html"
  ["Encoding"] => string(4) "8bit"
  ["ErrorInfo"] => string(0) ""
  ["From"] => string(18) "[email protected]"
  ["FromName"] => string(6) "duncan"
  ["Sender"] => string(0) ""
  ["Subject"] => string(6) "标题"
...["Subject"] => string(6) "标题"
但是邮件收到打开后的标题却是“标题标题”
不知为何重复了?

解决方案 »

  1.   


    $mail = new PHPMailer();
    $mail->IsSMTP(); // set mailer to use SMTP
    $mail->Host = $_POST['host']; // specify main and backup server
    $mail->SMTPAuth = false; // turn on SMTP authentication
    $mail->From = $_POST['from'];
    $mail->FromName =  $_POST['name'];
    $mail->AddAddress("$to",$_POST['name']); // name is optional
    $mail->IsHTML(true); // set email format to HTML
    $mail->Subject = $_POST['subject'];
    $mail->CharSet="utf-8";
    $mail->Body = $_POST['content'];
    $mail->Send();
      

  2.   


    require_once(dirname(__FILE__).'/phpmailer/class.phpmailer.php');
    $mail             = new PHPMailer();
    $mail->CharSet = "utf-8"; // 设置字符集编码 
    $mail->Encoding = "base64";//设置文本编码方式
    $mail->SMTPSecure = "ssl";                 // sets the prefix to the servier
    $mail->Host       = "smtp.126.com";      // sets GMAIL as the SMTP server
    $mail->Port       = 465;                   // set the SMTP port
    $mail->Username   = "[email protected]";  // GMAIL username
    $mail->Password   = "test";            // GMAIL password $mail->SetFrom('[email protected]', 'test');
    $mail->AddReplyTo('[email protected]','test'); $mail->AddAddress('[email protected]', "totest");
    $mail->Subject    = 'subject';  
    $mail->MsgHTML($message);   if(!$mail->Send()) {
      return false;
    } else {
      return true;
    }
      

  3.   

    有一个可能是mail发送的时候自带的“标题”
    查看你的phpmailer类里边是不是有类似这样的语句:
    $header[] = sprintf("标题%s\n", trim($this->Subject));//应该在create_header方法里边。