gpt4 book ai didi

symfony - 在 Symfony2 中使用假脱机和发送即时电子邮件的附加邮件服务 - 奇怪的 header

转载 作者:行者123 更新时间:2023-12-02 13:13:18 26 4
gpt4 key购买 nike

默认情况下,我使用假脱机邮件解决方案在我的网页中发送新闻通讯。但我还需要立即发送电子邮件。所以我用了this solution

如果我用 Spool 发送新闻通讯,一切都很好。但是当我使用时

$mailer = $this->get('instant_mailer');

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

HTTP/1.0 200 OK Cache-Control: no-cache Content-Type: text/html; charset=UTF-8 Date: Fri, 07 Sep 2012 16:19:06 GMT

如何删除这个?

最佳答案

我敢打赌您正在尝试发送 Response 对象。

new Response();

它转到__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();
}

这是因为:

$this->render('template.html.twig');

返回响应以避免这种使用:

$response = $this->render('template.html.twig');
$text = $response->getContent();

问候,最大

关于symfony - 在 Symfony2 中使用假脱机和发送即时电子邮件的附加邮件服务 - 奇怪的 header ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12322002/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com