Skip to content

[swiftmailer] Document whitelist option to email redirect #4924

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

Closed
wants to merge 9 commits into from

Conversation

TerjeBr
Copy link
Contributor

@TerjeBr TerjeBr commented Jan 26, 2015

The redirectPlugin in switfmailer allows you to specify a white-list of regex's that matches email addresses that are still sent to, when redirecting all email to one address.

Code was added in PR switfmailer/SwiftmailerBundle#19

The redirectPlugin in switfmailer allows you to specify a white list of regex's that are still sent to when disabling sending.
Added in PR switfmailer/SwiftmailerBundle#19
@TerjeBr TerjeBr changed the title Document whitelist option to email redirect [swiftmailer] Document whitelist option to email redirect Jan 26, 2015

Suppose you want to have all email sent to a specific address, instead
of the address actually specified when sending the message (like in the above scenario),
but you want certain email addresses not to be redirected in this way.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has become a very long sentence, let's try to make it a bit shorter. What do you think about?

Suppose you want all emails to be sent to ``[email protected]``, except
from the emails sent to ``[email protected]``. In this case, you
can use the ``delivery_whitelist`` option:

.. configuration-block::

    .. code-block:: yaml

        # app/config/config_dev.yml
        swiftmailer:
            delivery_address: [email protected]
            delivery_whitelist:
                # all email addresses matching this regex will *not* be
                # redirected to [email protected]
                - "/@mydomain.com$/"

                # all emails sent to [email protected] won't
                # be redirected to [email protected] too
                - "/^[email protected]$/"

    .. code-block:: xml

        <?xml version="1.0" charset="UTF-8" ?>
        <container xmlns="http://symfony.com/schema/dic/services"
            xmlns:swiftmailer="http://symfony.com/schema/dic/swiftmailer"
        >
            <swiftmailer:config delivery-address="[email protected]">
                <!-- all email adress matching this regex will *not* be redirected
                    to [email protected] -->
                <swiftmailer:delivery-whitelist-pattern>/@mydomain.com$/</swiftmaler:delivery-whitelist-pattern>

                <!-- all emails sent to [email protected] won't be
                    redirectd to [email protected] too -->
                <swiftmailer:delivery-whitelist-pattern>/^[email protected]$/</swiftmailer:delivery-whitelist-pattern>
            </swiftmailer:config>

(like in the above scenario to ``dev@example,com``).
But then you may want email sent to some specific email addresses to go through after all,
and not be redirected (even if it is in the dev environment).
This can be done by adding the ``delivery_whitelist`` option:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please reformat this to only add line breaks after the first word that crosses the 72th character? I.e:

Suppose you normally in your dev environment want to have all email redirected
to a specific address, (like in the above scenario to ``dev@example,com``).
But then you may want email sent to some specific email addresses to go through
after all, and not be redirected (even if it is in the dev environment).  This
can be done by adding the ``delivery_whitelist`` option:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -119,6 +119,58 @@ the replaced address, so you can still see who it would have been sent to.
These are ``X-Swift-Cc`` and ``X-Swift-Bcc`` for the ``CC`` and ``BCC``
addresses respectively.

Sending to a Specified Address, but with exceptions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the Symfony documentation, the titles follow some special notation. That's why this should be reworded as follows (unless @xabbuh suggest other rewording):

Original:
Sending to a Specified Address, but with exceptions

New:
Sending to a Specified Address but with Exceptions

@TerjeBr
Copy link
Contributor Author

TerjeBr commented Feb 18, 2015

Anything else before this can get the label finished?

xmlns:swiftmailer="http://symfony.com/schema/dic/swiftmailer"
http://symfony.com/schema/dic/swiftmailer http://symfony.com/schema/dic/swiftmailer/swiftmailer-1.0.xsd
-->

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should show a full XML config example here (I believe I've put an example in one of my comments in this PR)

@wouterj
Copy link
Member

wouterj commented Feb 18, 2015

Sorry @TerjeBr, 2 more issues. After that, I'll flag it as finished and @weaverryan wil ltake a look at it.

@TerjeBr
Copy link
Contributor Author

TerjeBr commented Feb 18, 2015

Ok. Done that.

@wouterj
Copy link
Member

wouterj commented Feb 18, 2015

Thanks! I've labelled it with finished now, I hope Ryan won't test your patience for too long :)

@weaverryan
Copy link
Member

Cool feature - I did not know about this. I've merged this into the 2.3 branch. Thanks @TerjeBr!

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