邮件内容不会破坏

时间:2013-02-25 04:45:00

标签: symfony phpmailer

我在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");

纯文本内容整洁,但电子邮件的内容在一行中。如何解决?

0 个答案:

没有答案