Skip to content

Commit

Permalink
API Migrate from swiftmailer/swiftmailer to symfony/mailer
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Sep 27, 2022
1 parent fc78763 commit 8218a10
Show file tree
Hide file tree
Showing 22 changed files with 832 additions and 1,540 deletions.
61 changes: 52 additions & 9 deletions _config/email.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,55 @@
---
Name: emailconfig
Name: mailer
---
SilverStripe\Core\Injector\Injector:
Swift_Transport: Swift_MailTransport
Swift_Mailer:
constructor:
- '%$Swift_Transport'
SilverStripe\Control\Email\Mailer:
class: SilverStripe\Control\Email\SwiftMailer
properties:
SwiftMailer: '%$Swift_Mailer'
Symfony\Component\Mailer\MailerInterface:
class: Symfony\Component\Mailer\Mailer
constructor:
0: '%$Symfony\Component\Mailer\Transport\TransportInterface'
1: '%$Symfony\Component\Messenger\MessageBusInterface.mailer'
2: '%$Symfony\Component\EventDispatcher\EventDispatcherInterface.mailer'
Symfony\Component\Messenger\MessageBusInterface.mailer:
class: Symfony\Component\Messenger\MessageBus
constructor:
0:
- '%$Symfony\Component\Messenger\Middleware\MiddlewareInterface.mailer'
Symfony\Component\Messenger\Middleware\MiddlewareInterface.mailer:
class: Symfony\Component\Messenger\Middleware\SendMessageMiddleware
constructor:
0: '%$Symfony\Component\Messenger\Transport\Sender\SendersLocatorInterface.mailer'
Symfony\Component\Messenger\Transport\Sender\SendersLocatorInterface.mailer:
class: Symfony\Component\Messenger\Transport\Sender\SendersLocator
constructor:
0:
'*':
- 'Symfony\Component\Messenger\Transport\Sender\SenderInterface.mailer'
1: '%$Symfony\Component\DependencyInjection\ContainerInterface.mailer'
Symfony\Component\Messenger\Transport\Sender\SenderInterface.mailer:
class: SilverStripe\Control\Email\EmailSender
Symfony\Component\DependencyInjection\ContainerInterface.mailer:
class: Symfony\Component\DependencyInjection\Container
calls:
- ['set', ['Symfony\Component\Messenger\Transport\Sender\SenderInterface.mailer', '%$Symfony\Component\Messenger\Transport\Sender\SenderInterface.mailer']]
Symfony\Component\EventDispatcher\EventDispatcherInterface.mailer:
class: Symfony\Component\EventDispatcher\EventDispatcher
---
Name: mailer-dsn-default-config
---
SilverStripe\Core\Injector\Injector:
Symfony\Component\Mailer\Transport\TransportInterface:
factory: Symfony\Component\Mailer\Transport
factory_method: fromDsn
constructor:
# TODO: confirm if this should be sendmail://default or native://default
# https://symfony.com/doc/current/mailer.html#using-built-in-transports
dsn: 'sendmail://default'
---
Name: mailer-dsn-env
After: mailer-dsn-default-config
Only:
envvarset: MAILER_DSN
---
SilverStripe\Core\Injector\Injector:
Symfony\Component\Mailer\Transport\TransportInterface:
constructor:
dsn: '`MAILER_DSN`'
4 changes: 4 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@
"swiftmailer/swiftmailer": "^6.3.0",
"symfony/cache": "^6.1",
"symfony/config": "^6.1",
"symfony/dependency-injection": "^6.1",
"symfony/filesystem": "^6.1",
"symfony/mailer": "^6.1",
"symfony/messenger": "^6.1",
"symfony/mime": "^6.1",
"symfony/translation": "^6.1",
"symfony/yaml": "^6.1",
"ext-ctype": "*",
Expand Down
Loading

0 comments on commit 8218a10

Please sign in to comment.