diff --git a/cookbook/email/email.rst b/cookbook/email/email.rst index 77392629a9f..1d9f42edc47 100644 --- a/cookbook/email/email.rst +++ b/cookbook/email/email.rst @@ -103,7 +103,8 @@ an email is pretty straightforward:: public function indexAction($name) { - $message = \Swift_Message::newInstance() + $mailer = $this->get('mailer'); + $message = $mailer->createMessage() ->setSubject('Hello Email') ->setFrom('send@example.com') ->setTo('recipient@example.com') @@ -114,7 +115,7 @@ an email is pretty straightforward:: ) ) ; - $this->get('mailer')->send($message); + $mailer->send($message); return $this->render(...); }