by default I use spool mailing solution for sending newsletter in my web page. But I also need to send email immediately. So I have used this solution
If I send newsletter with Spool everything is fine. But when I use
$mailer = $this->get('instant_mailer');
I receive email with some text prepend at the beginning:
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
How to remove this?
I bet that you're trying to send a Response object.
new Response();
it goes to __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();
}
It is because:
$this->render('template.html.twig');
returns Response to avoid that use:
$response = $this->render('template.html.twig');
$text = $response->getContent();
Regards, Max
Use
$content = $this->renderView('template.html.twig');
instead of
$content = $this->render('template.html.twig');
render returns a response
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With