Skip to content

[WIP][Mailer] Overwrite envelope sender and recipients from config #32081

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

Merged
merged 1 commit into from
Jul 3, 2019

Conversation

Devristo
Copy link
Contributor

@Devristo Devristo commented Jun 18, 2019

Q A
Branch? 4.4
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #31592 #31733
License MIT
Doc PR symfony/symfony-docs#...

Description

This MR adds the following configuration, example:

# config/packages/mailer.yaml
framework:
  mailer:
    envelope:
      sender: 'sender@example.org'
      recipients: ['redirected@example.org']

In turn the \Symfony\Component\Mailer\EventListener\EnvelopeListener will be configured to alter the sender and recipient addresses before the message has been sent.

Note: it will only alter the envelope, thus rerouting the message to the correct mailbox. However the message itself will still have the original 'from' and 'to' headers.

Todos

  • Alter configuration and dependency injection
  • Create test case
  • Update XML config schema?
  • Doc PR

@nicolas-grekas nicolas-grekas added this to the next milestone Jun 28, 2019
@fabpot
Copy link
Member

fabpot commented Jul 3, 2019

Thank you @Devristo.

@fabpot fabpot merged commit 8e0c800 into symfony:4.4 Jul 3, 2019
fabpot added a commit that referenced this pull request Jul 3, 2019
… from config (Devristo)

This PR was squashed before being merged into the 4.4 branch (closes #32081).

Discussion
----------

[WIP][Mailer] Overwrite envelope sender and recipients from config

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #31592 #31733   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

# Description

This MR adds the following configuration, example:

```yaml
# config/packages/mailer.yaml
framework:
  mailer:
    envelope:
      sender: 'sender@example.org'
      recipients: ['redirected@example.org']
```
In turn the `\Symfony\Component\Mailer\EventListener\EnvelopeListener` will be configured to alter the sender and recipient addresses before the message has been sent.

Note: it will only alter the envelope, thus rerouting the message to the correct mailbox. However the message itself will still have the original 'from' and 'to' headers.

# Todos

- [x] Alter configuration and dependency injection
- [x] Create test case
- [ ] Update XML config schema?
- [ ] Doc PR

<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.

Additionally (see https://symfony.com/roadmap):
 - Bug fixes must be submitted against the lowest maintained branch where they apply
   (lowest branches are regularly merged to upper ones so they get the fixes too).
 - Features and deprecations must be submitted against branch 4.4.
 - Legacy code removals go to the master branch.
-->

Commits
-------

8e0c800 [WIP][Mailer] Overwrite envelope sender and recipients from config
@Devristo Devristo deleted the mailer-config branch August 15, 2019 09:52
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.4 Oct 27, 2019
This was referenced Nov 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants