我在stackoverflow.com上找到了很多答案,但没有帮助我,所以我不得不问
问题:Phpmailer 发送邮件但空白邮件!没有身体没有执着!
//Create a new PHPMailer instance
$mail = new PHPMailer();
$mail->CharSet = 'UTF-8';
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "ssl://smtp.gmail.com"; // SMTP server
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Port = 465; // set the SMTP port for the GMAIL server; 465 for ssl and 587 for tls
$mail->Username = "services@domain.xxx"; // Gmail account username
$mail->Password = "pwd"; // Gmail account password
//$mail->Mailer = 'smtp';
//Set who the message is to be sent from
$mail->SetFrom(service_mail_d, 'XXXX Services');
//Set an alternative reply-to address
$mail->AddReplyTo(service_mail_d, 'XXXX Services');
//Set who the message is to be sent to
$mail->AddAddress("testcenter@xxxx.xxxxx", "Client1");
//Set the subject line
$mail->Subject = "service_order_subject" ;
//Read an HTML message body from an external file, convert referenced images to embedded,convert HTML into a basic plain-text alternative body
$mail->MsgHTML("<h1>Simple TEST</h1>");
$mail->AddStringAttachment($generator_file_content,$generatorId ."html",'UTF-8','text/html');
//Send the message, check for errors
$mailSend=$mail->Send();
更新:
如果没有添加StringAttachment,可以看到它的发送邮件和MsgBody!