额外的邮件服务使用假脱机并在Symfony2中发送即时电子邮件 - 奇怪的标题

Tom*_*Tom 5 spool swiftmailer symfony

默认情况下,我使用假脱机邮件解决方案在我的网页中发送简报.但我还需要立即发送电子邮件.所以我使用了这个解决方案

如果我用Spool发送简报,一切都很好.但是当我使用时

$mailer = $this->get('instant_mailer');
Run Code Online (Sandbox Code Playgroud)

我在开头收到一些带有一些文字的电子邮件:

HTTP/1.0 200 OK Cache-Control:no-cache Content-Type:text/html; charset = UTF-8日期:星期五,2012年9月7日16:19:06 GMT

如何删除?

Max*_*cki 7

我打赌你正在尝试发送一个Response对象.

new Response();
Run Code Online (Sandbox Code Playgroud)

它转到__toString()

public function __toString()
{
    $this->prepare();

    return
        sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText)."\r\n".
        $this->headers."\r\n".
        $this->getContent();
}
Run Code Online (Sandbox Code Playgroud)

这是因为:

$this->render('template.html.twig');
Run Code Online (Sandbox Code Playgroud)

返回响应以避免使用:

$response = $this->render('template.html.twig');
$text = $response->getContent();
Run Code Online (Sandbox Code Playgroud)

此致,Max