【发布时间】:2014-04-29 04:13:58
【问题描述】:
我在一个电子邮件模板上,该电子邮件模板将是基于动态的。所以我将模板制作为 PHP 文件,并在 PHP 中使用 INCLUDE 函数包含内容。电子邮件通过了,但我在电子邮件中收到 1。
PHP
ob_start();
$preview_contents = include( get_template_directory() . '/framework/newsletters/includes/preview.php' );
$content = ob_get_contents();
ob_end_clean();
PHPMAILER
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->IsHTML(true);
$mail->SMTPAuth = true;
$mail->Host = $host;
$mail->Username = $username;
$mail->Password = $pass;
$mail->SetFrom("no-reply@xxxxx.com", "Pacific xx");
$mail->AddAddress($subscribers_preview_email);
$mail->Subject = $subscribers_subject;
$mail->MsgHTML($preview_contents);
if($mail->Send()){
die("1 | An preview email has been sent to you.");
} else {
die("0 | There was an error, please try again later.");
}
【问题讨论】: