Tôi có một hành động cho phép thông báo email hệ thống xem trước khách hàng và tôi muốn gửi tiêu đề text/plain
cho các phiên bản thuần của email.Gửi tiêu đề văn bản thuần trong Symfony 2
Tôi đã cố gắng theo dõi phần Symfony docs : Requests and Responses in Symfony. Tuy nhiên, bộ điều khiển của tôi đang gửi một loại nội dung text/html
bất kể tôi làm gì.
Đây là hành động của tôi:
function showAction($action = null, $format = null){
$locale = $this->get('session')->getLocale();
$format = $this->getRequest()->get("format");
$format = isset($format) ? $format : 'html';
if ($format === 'text'){
$response = new Response();
$response->headers->set('Content-Type', 'text/plain');
$response->sendHeaders();
}
$view = sprintf('MyBundle:Email:%s.%s.%s.twig',
$action,$locale,$format);
return $this->render($view, array());
}
Vì vậy, làm thế nào để gửi một văn bản tiêu đề đơn giản và nơi tôi đi sai?
Brilliant, bạn đã lưu trong ngày của tôi. – max