Skip to content

[Swiftmailer] create Message by mailer service. #4884

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions cookbook/email/dev_environment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ Now, suppose you're sending an email to ``recipient@example.com``.

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')
Expand All @@ -102,7 +103,7 @@ Now, suppose you're sending an email to ``recipient@example.com``.
)
)
;
$this->get('mailer')->send($message);
$mailer->send($message);

return $this->render(...);
}
Expand Down
5 changes: 3 additions & 2 deletions cookbook/email/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ Start with an easy controller action that sends an e-mail::

public function sendEmailAction($name)
{
$message = \Swift_Message::newInstance()
$mailer = $this->get('mailer');
$message = $mailer->createMessage()
->setSubject('Hello Email')
->setFrom('send@example.com')
->setTo('recipient@example.com')
->setBody('You should see me from the profiler!')
;

$this->get('mailer')->send($message);
$mailer->send($message);

return $this->render(...);
}
Expand Down
10 changes: 5 additions & 5 deletions cookbook/web_services/php_soap_extension.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ In this case, the SOAP service will allow the client to call a method called

public function hello($name)
{

$message = \Swift_Message::newInstance()
->setTo('me@example.com')
->setSubject('Hello Service')
->setBody($name . ' says hi!');
$message = $this->mailer->createMessage()
->setTo('me@example.com')
->setSubject('Hello Service')
->setBody($name . ' says hi!')
;

$this->mailer->send($message);

Expand Down