Skip to content

Commit 2a7e34d

Browse files
committed
Remove the mailer implementation based on Swiftmailer
Swiftmailer is not maintained anymore.
1 parent 8af777c commit 2a7e34d

12 files changed

+5
-350
lines changed

composer.json

-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
"require-dev": {
5252
"doctrine/doctrine-bundle": "^1.3 || ^2",
5353
"friendsofphp/php-cs-fixer": "^3.0.2, !=3.5.0",
54-
"swiftmailer/swiftmailer": "^4.3 || ^5.0 || ^6.0",
5554
"symfony/console": "^6.4 || ^7.0",
5655
"symfony/mailer": "^6.4 || ^7.0",
5756
"symfony/mime": "^6.4 || ^7.0",

docs/emails.rst

+2-3
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,10 @@ a form to enter in a new password.
3838
Default Mailer Implementations
3939
------------------------------
4040

41-
The bundle comes with 3 mailer implementations. They are listed below
41+
The bundle comes with 2 mailer implementations. They are listed below
4242
by service id:
4343

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

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

220219
.. _ZetaMailer: https://github.com/simplethings/ZetaWebmailBundle/blob/master/UserBundle/ZetaMailer.php
221220
.. _ZetaWebmailBundle: https://github.com/simplethings/ZetaWebmailBundle

docs/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ logging in, creating users, etc.
370370
.. note::
371371

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

375375
Step 7: Update your database schema
376376
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

phpunit.xml.dist

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818
</filter>
1919

2020
<php>
21-
<env name="SYMFONY_DEPRECATIONS_HELPER" value="ignoreFile=tests/ignored-deprecations.txt&amp;max[total]=0" />
21+
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[total]=0" />
2222
</php>
2323
</phpunit>

src/DependencyInjection/Compiler/CheckForSwiftMailerPass.php

-49
This file was deleted.

src/DependencyInjection/FOSUserExtension.php

-2
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ private function loadRegistration(array $config, ContainerBuilder $container, Xm
212212
$fromEmail = $config['confirmation']['from_email'];
213213
unset($config['confirmation']['from_email']);
214214
}
215-
$container->setParameter('fos_user.registration.confirmation.from_email', [$fromEmail['address'] => $fromEmail['sender_name']]);
216215
$container->setParameter('fos_user.registration.confirmation.from_address', $fromEmail);
217216

218217
$this->remapParametersNamespaces($config, $container, [
@@ -247,7 +246,6 @@ private function loadResetting(array $config, ContainerBuilder $container, XmlFi
247246
$fromEmail = $config['email']['from_email'];
248247
unset($config['email']['from_email']);
249248
}
250-
$container->setParameter('fos_user.resetting.email.from_email', [$fromEmail['address'] => $fromEmail['sender_name']]);
251249
$container->setParameter('fos_user.resetting.email.from_address', $fromEmail);
252250

253251
$this->remapParametersNamespaces($config, $container, [

src/FOSUserBundle.php

-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass;
1515
use Doctrine\Bundle\MongoDBBundle\DependencyInjection\Compiler\DoctrineMongoDBMappingsPass;
1616
use FOS\UserBundle\DependencyInjection\Compiler\CheckForSessionPass;
17-
use FOS\UserBundle\DependencyInjection\Compiler\CheckForSwiftMailerPass;
1817
use FOS\UserBundle\DependencyInjection\Compiler\InjectRememberMeServicesPass;
1918
use FOS\UserBundle\DependencyInjection\Compiler\InjectUserCheckerPass;
2019
use FOS\UserBundle\DependencyInjection\Compiler\ValidationPass;
@@ -34,7 +33,6 @@ public function build(ContainerBuilder $container): void
3433
$container->addCompilerPass(new InjectUserCheckerPass());
3534
$container->addCompilerPass(new InjectRememberMeServicesPass());
3635
$container->addCompilerPass(new CheckForSessionPass());
37-
$container->addCompilerPass(new CheckForSwiftMailerPass());
3836

3937
$this->addRegisterMappingsPass($container);
4038
}

src/Mailer/NoopMailer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/**
1717
* This mailer does nothing.
1818
* It is used when the 'email' configuration is not set,
19-
* and allows to use this bundle without swiftmailer.
19+
* and allows to use this bundle without a mailer component.
2020
*
2121
* @author Thibault Duplessis <[email protected]>
2222
*/

src/Mailer/TwigSwiftMailer.php

-120
This file was deleted.

src/Resources/config/mailer.xml

-23
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@
77
<parameters>
88
<parameter key="fos_user.resetting.email.template">@FOSUser/Resetting/email.txt.twig</parameter>
99
<parameter key="fos_user.registration.confirmation.template">@FOSUser/Registration/email.txt.twig</parameter>
10-
<parameter key="fos_user.registration.confirmation.from_email" type="collection">
11-
<parameter key="[email protected]">Acme Ltd</parameter>
12-
</parameter>
13-
<parameter key="fos_user.resetting.email.from_email" type="collection">
14-
<parameter key="[email protected]">Acme Ltd</parameter>
15-
</parameter>
1610
<parameter key="fos_user.registration.confirmation.from_address" type="collection">
1711
<parameter key="address">[email protected]</parameter>
1812
<parameter key="sender_name">Acme Ltd</parameter>
@@ -24,23 +18,6 @@
2418
</parameters>
2519

2620
<services>
27-
<service id="fos_user.mailer.twig_swift" class="FOS\UserBundle\Mailer\TwigSwiftMailer" public="false">
28-
<argument type="service" id="swiftmailer.mailer" />
29-
<argument type="service" id="router" />
30-
<argument type="service" id="twig" />
31-
<argument type="collection">
32-
<argument key="template" type="collection">
33-
<argument key="confirmation">%fos_user.registration.confirmation.template%</argument>
34-
<argument key="resetting">%fos_user.resetting.email.template%</argument>
35-
</argument>
36-
<argument key="from_email" type="collection">
37-
<argument key="confirmation">%fos_user.registration.confirmation.from_email%</argument>
38-
<argument key="resetting">%fos_user.resetting.email.from_email%</argument>
39-
</argument>
40-
</argument>
41-
<tag name="fos_user.requires_swift" />
42-
</service>
43-
4421
<service id="fos_user.mailer.twig_symfony" class="FOS\UserBundle\Mailer\TwigSymfonyMailer" public="false">
4522
<argument type="service" id="mailer" />
4623
<argument type="service" id="router" />

0 commit comments

Comments
 (0)