Skip to content

Take into account the EOM of Swiftmailer in docs #15727

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

Merged
merged 1 commit into from
Aug 19, 2021
Merged
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
7 changes: 0 additions & 7 deletions components/http_kernel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -498,12 +498,6 @@ as possible to the client (e.g. sending emails).
Using the ``kernel.terminate`` event is optional, and should only be
called if your kernel implements :class:`Symfony\\Component\\HttpKernel\\TerminableInterface`.

.. sidebar:: ``kernel.terminate`` in the Symfony Framework

If you use the :ref:`memory spooling <email-spool-memory>` option of the
default Symfony mailer, then the `EmailSenderListener`_ is activated, which
actually delivers any emails that you scheduled to send during the request.

.. _component-http-kernel-kernel-exception:

Handling Exceptions: the ``kernel.exception`` Event
Expand Down Expand Up @@ -783,5 +777,4 @@ Learn more
.. _`SensioFrameworkExtraBundle`: https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/index.html
.. _`@ParamConverter`: https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/converters.html
.. _`@Template`: https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/view.html
.. _`EmailSenderListener`: https://github.com/symfony/swiftmailer-bundle/blob/master/EventListener/EmailSenderListener.php
.. _variadic: https://www.php.net/manual/en/functions.arguments.php#functions.variable-arg-list
18 changes: 8 additions & 10 deletions console/command_in_controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ Instead, you can run the command directly from the controller.
a controller has a slight performance impact because of the request stack
overhead.

Imagine you want to send spooled Swift Mailer messages by
:doc:`using the swiftmailer:spool:send command </email>`.
Run this command from inside your controller via::
Imagine you want to run the ``debug:twig`` from inside your controller::

// src/Controller/SpoolController.php
// src/Controller/DebugTwigController.php
namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Console\Application;
Expand All @@ -34,19 +32,19 @@ Run this command from inside your controller via::
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\KernelInterface;

class SpoolController extends AbstractController
class DebugTwigController extends AbstractController
{
public function sendSpool(int $messages = 10, KernelInterface $kernel): Response
public function debugTwig(KernelInterface $kernel): Response
{
$application = new Application($kernel);
$application->setAutoExit(false);

$input = new ArrayInput([
'command' => 'swiftmailer:spool:send',
'command' => 'debug:twig',
// (optional) define the value of command arguments
'fooArgument' => 'barValue',
// (optional) pass options to the command
'--message-limit' => $messages,
'--bar' => 'fooValue',
]);

// You can use NullOutput() if you don't need the output
Expand Down Expand Up @@ -76,7 +74,7 @@ First, require the package:

Now, use it in your controller::

// src/Controller/SpoolController.php
// src/Controller/DebugTwigController.php
namespace App\Controller;

use SensioLabs\AnsiConverter\AnsiToHtmlConverter;
Expand All @@ -85,7 +83,7 @@ Now, use it in your controller::
use Symfony\Component\HttpFoundation\Response;
// ...

class SpoolController extends AbstractController
class DebugTwigController extends AbstractController
{
public function sendSpool(int $messages = 10): Response
{
Expand Down
7 changes: 4 additions & 3 deletions email.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
Swift Mailer
============

.. note::
.. caution::

In Symfony 4.3, the :doc:`Mailer </mailer>` component was introduced and can
be used instead of Swift Mailer.
In Symfony 4.3, the :doc:`Mailer </mailer>` component was introduced and should
be used instead of Swift Mailer as it won't be maintained anymore as of November
2021.

Symfony provides a mailer feature based on the popular `Swift Mailer`_ library
via the `SwiftMailerBundle`_. This mailer supports sending messages with your
Expand Down
4 changes: 2 additions & 2 deletions mailer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Sending Emails with Mailer

.. versionadded:: 4.3

The Mailer component was introduced in Symfony 4.3. The previous solution,
called Swift Mailer, is still valid: :doc:`Swift Mailer </email>`.
The Mailer component was introduced in Symfony 4.3 and replaces Swift
Mailer.

Installation
------------
Expand Down
2 changes: 1 addition & 1 deletion migration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Setting up Composer
Another point you will have to look out for is conflicts between
dependencies in both applications. This is especially important if your
existing application already uses Symfony components or libraries commonly
used in Symfony applications such as Doctrine ORM, Swiftmailer or Twig.
used in Symfony applications such as Doctrine ORM or Twig.
A good way for ensuring compatibility is to use the same ``composer.json``
for both project's dependencies.

Expand Down