Skip to content

Commit 7f8b051

Browse files
committed
Changed email message instantiation to a more 'symfonysh' way.
1 parent 236c26f commit 7f8b051

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cookbook/email/email.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ an email is pretty straightforward::
103103

104104
public function indexAction($name)
105105
{
106-
$message = \Swift_Message::newInstance()
106+
$mailer = $this->get('mailer');
107+
$message = $mailer->createMessage()
107108
->setSubject('Hello Email')
108109
->setFrom('[email protected]')
109110
->setTo('[email protected]')
@@ -114,7 +115,7 @@ an email is pretty straightforward::
114115
)
115116
)
116117
;
117-
$this->get('mailer')->send($message);
118+
$mailer->send($message);
118119

119120
return $this->render(...);
120121
}

0 commit comments

Comments
 (0)