Skip to content

Commit

Permalink
Remove the mailer implementation based on Swiftmailer
Browse files Browse the repository at this point in the history
Swiftmailer is not maintained anymore.
  • Loading branch information
stof committed Jun 24, 2024
1 parent 8af777c commit 2a7e34d
Show file tree
Hide file tree
Showing 12 changed files with 5 additions and 350 deletions.
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
"require-dev": {
"doctrine/doctrine-bundle": "^1.3 || ^2",
"friendsofphp/php-cs-fixer": "^3.0.2, !=3.5.0",
"swiftmailer/swiftmailer": "^4.3 || ^5.0 || ^6.0",
"symfony/console": "^6.4 || ^7.0",
"symfony/mailer": "^6.4 || ^7.0",
"symfony/mime": "^6.4 || ^7.0",
Expand Down
5 changes: 2 additions & 3 deletions docs/emails.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,10 @@ a form to enter in a new password.
Default Mailer Implementations
------------------------------

The bundle comes with 3 mailer implementations. They are listed below
The bundle comes with 2 mailer implementations. They are listed below
by service id:

- ``fos_user.mailer.twig_symfony`` uses symfony/mailer to send emails and Twig blocks to render the message.
- ``fos_user.mailer.twig_swift`` uses Swiftmailer to send emails and Twig blocks to render the message.
- ``fos_user.mailer.noop`` is a mailer implementation which performs no operation, so no emails are sent.

.. note::
Expand Down Expand Up @@ -215,7 +214,7 @@ An example is listed below.
To see an example of a working implementation of the ``MailerInterface``
see the `ZetaMailer`_ class of the `ZetaWebmailBundle`_. This implementation
uses the Zeta Components Mail to send emails instead of Swiftmailer.
uses the Zeta Components Mail to send emails instead of the mailer component.

.. _ZetaMailer: https://github.com/simplethings/ZetaWebmailBundle/blob/master/UserBundle/ZetaMailer.php
.. _ZetaWebmailBundle: https://github.com/simplethings/ZetaWebmailBundle
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ logging in, creating users, etc.
.. note::

In order to use the built-in email functionality (confirmation of the account,
resetting of the password), you must activate and configure the SwiftmailerBundle.
resetting of the password), you must activate and configure the mailer.

Step 7: Update your database schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
</filter>

<php>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="ignoreFile=tests/ignored-deprecations.txt&amp;max[total]=0" />
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[total]=0" />
</php>
</phpunit>
49 changes: 0 additions & 49 deletions src/DependencyInjection/Compiler/CheckForSwiftMailerPass.php

This file was deleted.

2 changes: 0 additions & 2 deletions src/DependencyInjection/FOSUserExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ private function loadRegistration(array $config, ContainerBuilder $container, Xm
$fromEmail = $config['confirmation']['from_email'];
unset($config['confirmation']['from_email']);
}
$container->setParameter('fos_user.registration.confirmation.from_email', [$fromEmail['address'] => $fromEmail['sender_name']]);
$container->setParameter('fos_user.registration.confirmation.from_address', $fromEmail);

$this->remapParametersNamespaces($config, $container, [
Expand Down Expand Up @@ -247,7 +246,6 @@ private function loadResetting(array $config, ContainerBuilder $container, XmlFi
$fromEmail = $config['email']['from_email'];
unset($config['email']['from_email']);
}
$container->setParameter('fos_user.resetting.email.from_email', [$fromEmail['address'] => $fromEmail['sender_name']]);
$container->setParameter('fos_user.resetting.email.from_address', $fromEmail);

$this->remapParametersNamespaces($config, $container, [
Expand Down
2 changes: 0 additions & 2 deletions src/FOSUserBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass;
use Doctrine\Bundle\MongoDBBundle\DependencyInjection\Compiler\DoctrineMongoDBMappingsPass;
use FOS\UserBundle\DependencyInjection\Compiler\CheckForSessionPass;
use FOS\UserBundle\DependencyInjection\Compiler\CheckForSwiftMailerPass;
use FOS\UserBundle\DependencyInjection\Compiler\InjectRememberMeServicesPass;
use FOS\UserBundle\DependencyInjection\Compiler\InjectUserCheckerPass;
use FOS\UserBundle\DependencyInjection\Compiler\ValidationPass;
Expand All @@ -34,7 +33,6 @@ public function build(ContainerBuilder $container): void
$container->addCompilerPass(new InjectUserCheckerPass());
$container->addCompilerPass(new InjectRememberMeServicesPass());
$container->addCompilerPass(new CheckForSessionPass());
$container->addCompilerPass(new CheckForSwiftMailerPass());

$this->addRegisterMappingsPass($container);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Mailer/NoopMailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/**
* This mailer does nothing.
* It is used when the 'email' configuration is not set,
* and allows to use this bundle without swiftmailer.
* and allows to use this bundle without a mailer component.
*
* @author Thibault Duplessis <[email protected]>
*/
Expand Down
120 changes: 0 additions & 120 deletions src/Mailer/TwigSwiftMailer.php

This file was deleted.

23 changes: 0 additions & 23 deletions src/Resources/config/mailer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@
<parameters>
<parameter key="fos_user.resetting.email.template">@FOSUser/Resetting/email.txt.twig</parameter>
<parameter key="fos_user.registration.confirmation.template">@FOSUser/Registration/email.txt.twig</parameter>
<parameter key="fos_user.registration.confirmation.from_email" type="collection">
<parameter key="[email protected]">Acme Ltd</parameter>
</parameter>
<parameter key="fos_user.resetting.email.from_email" type="collection">
<parameter key="[email protected]">Acme Ltd</parameter>
</parameter>
<parameter key="fos_user.registration.confirmation.from_address" type="collection">
<parameter key="address">[email protected]</parameter>
<parameter key="sender_name">Acme Ltd</parameter>
Expand All @@ -24,23 +18,6 @@
</parameters>

<services>
<service id="fos_user.mailer.twig_swift" class="FOS\UserBundle\Mailer\TwigSwiftMailer" public="false">
<argument type="service" id="swiftmailer.mailer" />
<argument type="service" id="router" />
<argument type="service" id="twig" />
<argument type="collection">
<argument key="template" type="collection">
<argument key="confirmation">%fos_user.registration.confirmation.template%</argument>
<argument key="resetting">%fos_user.resetting.email.template%</argument>
</argument>
<argument key="from_email" type="collection">
<argument key="confirmation">%fos_user.registration.confirmation.from_email%</argument>
<argument key="resetting">%fos_user.resetting.email.from_email%</argument>
</argument>
</argument>
<tag name="fos_user.requires_swift" />
</service>

<service id="fos_user.mailer.twig_symfony" class="FOS\UserBundle\Mailer\TwigSymfonyMailer" public="false">
<argument type="service" id="mailer" />
<argument type="service" id="router" />
Expand Down
Loading

0 comments on commit 2a7e34d

Please sign in to comment.