Symfony 2에서 개발 한 응용 프로그램이 있습니다. 전자 메일을 보내는 번들로 연락 양식이 있습니다. 이 코드와 함께 작동합니다. Swift Emailer 드문 행동
$message = \Swift_Message::newInstance()
->setSubject('Nueva consulta desde el formulario de contacto')
->setFrom($contacto->getEmail())
->setTo($this->container->getParameter('portada.emails.contact_email'))
->setBody($this->renderView('PortadaBundle:Page:contactoEmail.txt.twig', array('contacto' => $contacto)));
$this->get('mailer')->send($message);
그리고이 코드는하지
$message = \Swift_Message::newInstance()
->setSubject('Test to send emails from other bundle')
->setFrom('[email protected]') //mail commented
->setTo('[email protected]') //mail commented
->setBody('Hello');
$this->get('mailer')->send($message);
내가 무슨 일이 일어나고 있는지 이해가 안 WORKS 같은 응용 프로그램에서 다른 번들
. 너무 희귀합니다 ... 설명서를 확인했지만 모두 정확해 보입니다. http://symfony.com/doc/2.1/cookbook/email/email.html두 번째 매개 변수를 추가하여 메서드 -> send ($ message, $ failureures)를 보냈습니다. 하지만 그것은 나에게 항목이없는 배열을 반환합니다.
단서가 있습니까?
편집 : 첫 번 째 번들에 두 번째 코드가 복사되어 정상적으로 작동합니다. 번들에 관한 것이어야합니다.
또 다른 단서? :)
어떤 버전을 사용하고 있습니까? 당신은'$ this-> get ('mailer') -> send ($ message);'? – Erioch
Symfony 2.1. 예, 응답이 '1'이됩니다. – Freenando