我在 Symfony 2 中使用 PHP 邮件程序发送邮件。
$mail = new PHPMailer;
$mail->IsSMTP();
$mail->Host = MAIL_HOST;
$mail->SMTPDebug = MAIL_SMTP_DEBUG;
$mail->Port = MAIL_PORT;
$this->setFrom($mail, $params);
$this->setFromName($mail, $params);
$this->setAddress($mail, $params);
$this->setCc($mail, $params);
$this->setBcc($mail, $params);
$this->setWordWrap($mail, $params);
$this->setIsHtml($mail, $params); // = false
$this->setSubject($mail, $params);
$this->setBody($mail, $params);
$this->setAltBody($mail, $params);
$mail->ContentType = 'text/plain';
$mail->CharSet = 'UTF-8';
$r = $mail->Send();
使用 file_get_content() 获取邮件内容
$body = file_get_contents($params["mailPath"] . "/registMailContent.html.php");
纯文本的内容很简洁,但电子邮件的内容只有一行。如何解决?