mailer_transports.php 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\DependencyInjection\Loader\Configurator;
  11. use Symfony\Component\Mailer\Bridge\Amazon\Transport\SesTransportFactory;
  12. use Symfony\Component\Mailer\Bridge\Google\Transport\GmailTransportFactory;
  13. use Symfony\Component\Mailer\Bridge\Mailchimp\Transport\MandrillTransportFactory;
  14. use Symfony\Component\Mailer\Bridge\Mailgun\Transport\MailgunTransportFactory;
  15. use Symfony\Component\Mailer\Bridge\Mailjet\Transport\MailjetTransportFactory;
  16. use Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkTransportFactory;
  17. use Symfony\Component\Mailer\Bridge\Sendgrid\Transport\SendgridTransportFactory;
  18. use Symfony\Component\Mailer\Bridge\Sendinblue\Transport\SendinblueTransportFactory;
  19. use Symfony\Component\Mailer\Transport\AbstractTransportFactory;
  20. use Symfony\Component\Mailer\Transport\NativeTransportFactory;
  21. use Symfony\Component\Mailer\Transport\NullTransportFactory;
  22. use Symfony\Component\Mailer\Transport\SendmailTransportFactory;
  23. use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransportFactory;
  24. return static function (ContainerConfigurator $container) {
  25. $container->services()
  26. ->set('mailer.transport_factory.abstract', AbstractTransportFactory::class)
  27. ->abstract()
  28. ->args([
  29. service('event_dispatcher'),
  30. service('http_client')->ignoreOnInvalid(),
  31. service('logger')->ignoreOnInvalid(),
  32. ])
  33. ->set('mailer.transport_factory.amazon', SesTransportFactory::class)
  34. ->parent('mailer.transport_factory.abstract')
  35. ->tag('mailer.transport_factory')
  36. ->set('mailer.transport_factory.gmail', GmailTransportFactory::class)
  37. ->parent('mailer.transport_factory.abstract')
  38. ->tag('mailer.transport_factory')
  39. ->set('mailer.transport_factory.mailchimp', MandrillTransportFactory::class)
  40. ->parent('mailer.transport_factory.abstract')
  41. ->tag('mailer.transport_factory')
  42. ->set('mailer.transport_factory.mailjet', MailjetTransportFactory::class)
  43. ->parent('mailer.transport_factory.abstract')
  44. ->tag('mailer.transport_factory')
  45. ->set('mailer.transport_factory.mailgun', MailgunTransportFactory::class)
  46. ->parent('mailer.transport_factory.abstract')
  47. ->tag('mailer.transport_factory')
  48. ->set('mailer.transport_factory.postmark', PostmarkTransportFactory::class)
  49. ->parent('mailer.transport_factory.abstract')
  50. ->tag('mailer.transport_factory')
  51. ->set('mailer.transport_factory.sendgrid', SendgridTransportFactory::class)
  52. ->parent('mailer.transport_factory.abstract')
  53. ->tag('mailer.transport_factory')
  54. ->set('mailer.transport_factory.null', NullTransportFactory::class)
  55. ->parent('mailer.transport_factory.abstract')
  56. ->tag('mailer.transport_factory')
  57. ->set('mailer.transport_factory.sendmail', SendmailTransportFactory::class)
  58. ->parent('mailer.transport_factory.abstract')
  59. ->tag('mailer.transport_factory')
  60. ->set('mailer.transport_factory.sendinblue', SendinblueTransportFactory::class)
  61. ->parent('mailer.transport_factory.abstract')
  62. ->tag('mailer.transport_factory')
  63. ->set('mailer.transport_factory.smtp', EsmtpTransportFactory::class)
  64. ->parent('mailer.transport_factory.abstract')
  65. ->tag('mailer.transport_factory', ['priority' => -100])
  66. ->set('mailer.transport_factory.native', NativeTransportFactory::class)
  67. ->parent('mailer.transport_factory.abstract')
  68. ->tag('mailer.transport_factory');
  69. };