diff --git a/email.rst b/email.rst index e2eff022501..d98e60dae95 100644 --- a/email.rst +++ b/email.rst @@ -103,7 +103,7 @@ an email is pretty straightforward:: public function indexAction($name) { - $message = new \Swift_Message('Hello Email') + $message = (new \Swift_Message('Hello Email')) ->setFrom('send@example.com') ->setTo('recipient@example.com') ->setBody( @@ -125,6 +125,7 @@ an email is pretty straightforward:: ) */ ; + $this->get('mailer')->send($message); return $this->render(...); diff --git a/email/dev_environment.rst b/email/dev_environment.rst index b62be5195ef..dcca77b2ee0 100644 --- a/email/dev_environment.rst +++ b/email/dev_environment.rst @@ -100,7 +100,7 @@ Now, suppose you're sending an email to ``recipient@example.com``. public function indexAction($name) { - $message = new \Swift_Message('Hello Email') + $message = (new \Swift_Message('Hello Email')) ->setFrom('send@example.com') ->setTo('recipient@example.com') ->setBody( @@ -110,6 +110,7 @@ Now, suppose you're sending an email to ``recipient@example.com``. ) ) ; + $this->get('mailer')->send($message); return $this->render(...); diff --git a/email/testing.rst b/email/testing.rst index ca29af4afc8..d7b40dbfa0f 100644 --- a/email/testing.rst +++ b/email/testing.rst @@ -14,7 +14,7 @@ Start with an easy controller action that sends an email:: public function sendEmailAction($name) { - $message = new \Swift_Message('Hello Email') + $message = (new \Swift_Message('Hello Email')) ->setFrom('send@example.com') ->setTo('recipient@example.com') ->setBody('You should see me from the profiler!')