-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] Move mailer configuration to php #37204
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
use Symfony\Component\Mailer\EventListener\EnvelopeListener; | ||
use Symfony\Component\Mailer\EventListener\MessageListener; | ||
8000 use Symfony\Component\Mailer\EventListener\MessageLoggerListener; | ||
use Symfony\Component\Mailer\Mailer; | ||
use Symfony\Component\Mailer\MailerInterface; | ||
use Symfony\Component\Mailer\Messenger\MessageHandler; | ||
use Symfony\Component\Mailer\Transport; | ||
use Symfony\Component\Mailer\Transport\TransportInterface; | ||
use Symfony\Component\Mailer\Transport\Transports; | ||
|
||
return static function (ContainerConfigurator $container) { | ||
$container->services() | ||
->set('mailer.mailer', Mailer::class) | ||
->args([ | ||
service('mailer.transports'), | ||
abstract_arg('message bus'), | ||
service('event_dispatcher')->ignoreOnInvalid(), | ||
]) | ||
->alias('mailer', 'mailer.mailer') | ||
->alias(MailerInterface::class, 'mailer.mailer') | ||
|
||
->set('mailer.transports', Transports::class) | ||
->factory([service('mailer.transport_factory'), 'fromStrings']) | ||
->args([ | ||
abstract_arg('transports'), | ||
]) | ||
|
||
->set('mailer.transport_factory', Transport::class) | ||
->args([ | ||
tagged_iterator('mailer.transport_factory'), | ||
]) | ||
|
||
->set('mailer.default_transport', TransportInterface::class) | ||
->factory([service('mailer.transport_factory'), 'fromString']) | ||
->args([ | ||
abstract_arg('env(MAILER_DSN)'), | ||
]) | ||
->alias(TransportInterface::class, 'mailer.default_transport') | ||
|
||
->set('mailer.messenger.message_handler', MessageHandler::class) | ||
->args([ | ||
service('mailer.transports'), | ||
]) | ||
->tag('messenger.message_handler') | ||
|
||
->set('mailer.envelope_listener', EnvelopeListener::class) | ||
->args([ | ||
abstract_arg('sender'), | ||
abstract_arg('recipients'), | ||
]) | ||
->tag('kernel.event_subscriber') | ||
|
||
->set('mailer.message_listener', MessageListener::class) | ||
->args([ | ||
abstract_arg('headers'), | ||
]) | ||
->tag('kernel.event_subscriber') | ||
|
||
->set('mailer.logger_message_listener', MessageLoggerListener::class) | ||
->tag('kernel.event_subscriber') | ||
; | ||
}; |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
use Symfony\Component\Mailer\DataCollector\MessageDataCollector; | ||
|
||
return static function (ContainerConfigurator $container) { | ||
$container->services() | ||
->set('mailer.data_collector', MessageDataCollector::class) | ||
->args([ | ||
service('mailer.logger_message_listener'), | ||
]) | ||
->tag('data_collector', [ | ||
'template' => '@WebProfiler/Collector/mailer.html.twig', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please change the order of template and id to be consistent with the other data_collector tags There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ✅ |
||
'id' => 'mailer', | ||
]) | ||
; | ||
}; |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
use Symfony\Component\Mailer\Bridge\Amazon\Transport\SesTransportFactory; | ||
use Symfony\Component\Mailer\Bridge\Google\Transport\GmailTransportFactory; | ||
use Symfony\Component\Mailer\Bridge\Mailchimp\Transport\MandrillTransportFactory; | ||
use Symfony\Component\Mailer\Bridge\Mailgun\Transport\MailgunTransportFactory; | ||
use Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkTransportFactory; | ||
use Symfony\Component\Mailer\Bridge\Sendgrid\Transport\SendgridTransportFactory; | ||
use Symfony\Component\Mailer\Transport\AbstractTransportFactory; | ||
use Symfony\Component\Mailer\Transport\NullTransportFactory; | ||
use Symfony\Component\Mailer\Transport\SendmailTransportFactory; | ||
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransportFactory; | ||
|
||
return static function (ContainerConfigurator $container) { | ||
$container->services() | ||
->set('mailer.transport_factory.abstract', AbstractTransportFactory::class) | ||
->abstract() | ||
->args([ | ||
service('event_dispatcher'), | ||
service('http_client')->ignoreOnInvalid(), | ||
service('logger')->ignoreOnInvalid(), | ||
]) | ||
|
||
->set('mailer.transport_factory.amazon', SesTransportFactory::class) | ||
->parent('mailer.transport_factory.abstract') | ||
->tag('mailer.transport_factory') | ||
|
||
->set('mailer.transport_factory.gmail', GmailTransportFactory::class) | ||
->parent('mailer.transport_factory.abstract') | ||
->tag('mailer.transport_factory') | ||
|
||
->set('mailer.transport_factory.mailchimp', MandrillTransportFactory::class) | ||
->parent('mailer.transport_factory.abstract') | ||
->tag('mailer.transport_factory') | ||
|
||
->set('mailer.transport_factory.mailgun', MailgunTransportFactory::class) | ||
->parent('mailer.transport_factory.abstract') | ||
->tag('mailer.transport_factory') | ||
|
||
->set('mailer.transport_factory.postmark', PostmarkTransportFactory::class) | ||
->parent('mailer.transport_factory.abstract') | ||
->tag('mailer.transport_factory') | ||
|
||
->set('mailer.transport_factory.sendgrid', SendgridTransportFactory::class) | ||
->parent('mailer.transport_factory.abstract') | ||
->tag('mailer.transport_factory') | ||
|
||
->set('mailer.transport_factory.null', NullTransportFactory::class) | ||
->parent('mailer.transport_factory.abstract') | ||
->tag('mailer.transport_factory') | ||
|
||
->set('mailer.transport_factory.sendmail', SendmailTransportFactory::class) | ||
->parent('mailer.transport_factory.abstract') | ||
->tag('mailer.transport_factory') | ||
|
||
->set('mailer.transport_factory.smtp', EsmtpTransportFactory::class) | ||
->parent('mailer.transport_factory.abstract') | ||
->tag('mailer.transport_factory', ['priority' => -100]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should i set string or int value for the priority attribute? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. int is fine |
||
; | ||
}; |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.