This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Bundle
Fabien Potencier 2ad7f97568 feature #33409 [Mailer] Add support for multiple mailers (fabpot)
This PR was merged into the 4.4 branch.

Discussion
----------

[Mailer] Add support for multiple mailers

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | closes #32535
| License       | MIT
| Doc PR        | -

This adds the possibility to define several email transports.

If you only have one email transport,  nothing changes:

```yaml
framework:
    mailer:
        dsn: '%env(MAILER_DSN)%'
```

But if you need more than one, use the `transports` entry instead:

```yaml
framework:
    mailer:
        transports:
            main: '%env(MAILER_DSN)%'
            important: '%env(MAILER_DSN_IMPORTANT)%'
```

Then, when sending an email via the `Mailer`, pass the mailer name explicitly (by default, the first one is used):

```php
// use the first "main" transport
$mailer->send($email);

// or use the "important" one (`null` is the envelope)
$mailer->send($email, null, 'important');
```

The web profiler now displays the name and the shorten DSN.

Commits
-------

de5fae4dd8 [Mailer] Add support for multiple mailers
2019-09-02 16:12:44 +02:00
..
DebugBundle Add more return types after fixing a typo in my script 2019-08-23 14:16:45 +02:00
FrameworkBundle feature #33409 [Mailer] Add support for multiple mailers (fabpot) 2019-09-02 16:12:44 +02:00
SecurityBundle Merge branch '4.3' into 4.4 2019-08-26 11:00:56 +02:00
TwigBundle conflict with HttpKernel 5 2019-08-30 13:37:47 +02:00
WebProfilerBundle Merge branch '4.3' into 4.4 2019-08-26 11:00:56 +02:00
WebServerBundle Merge branch '4.3' into 4.4 2019-08-20 16:44:19 +02:00
FullStack.php [FrameworkBundle] changed some default configs from canBeEnabled to canBeDisabled 2017-01-07 14:17:04 -08:00