Skip to content
This repository was archived by the owner on Feb 6, 2022. It is now read-only.

Commit d2eae93

Browse files
committed
Merge pull request #19 from lstrojny/delivery-whitelist
Allow specifying delivery whitelists for the redirect plugin
2 parents fcacc9e + 3930be7 commit d2eae93

33 files changed

+394
-25
lines changed

DependencyInjection/Configuration.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ public function getConfigTreeBuilder()
8383
->end()
8484
->end()
8585
->scalarNode('delivery_address')->end()
86+
->end()
87+
->fixXmlConfig('delivery_whitelist_pattern', 'delivery_whitelist')
88+
->children()
89+
->arrayNode('delivery_whitelist')
90+
->prototype('scalar')
91+
->end()
92+
->end()
8693
->booleanNode('disable_delivery')->end()
8794
->booleanNode('logging')->defaultValue($this->debug)->end()
8895
->end()

DependencyInjection/SwiftmailerExtension.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ public function load(array $configs, ContainerBuilder $container)
126126
} else {
127127
$container->setParameter('swiftmailer.single_address', null);
128128
}
129+
$container->setParameter('swiftmailer.delivery_whitelist', $config['delivery_whitelist']);
129130
}
130131

131132
/**

Resources/config/schema/swiftmailer-1.0.xsd

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
<xsd:element name="config" type="config" />
99

1010
<xsd:complexType name="config">
11-
<xsd:all>
12-
<xsd:element name="spool" type="spool" minOccurs="0" maxOccurs="1" />
11+
<xsd:sequence>
1312
<xsd:element name="antiflood" type="antiflood" minOccurs="0" maxOccurs="1" />
14-
</xsd:all>
13+
<xsd:element name="spool" type="spool" minOccurs="0" maxOccurs="1" />
14+
<xsd:element name="delivery-whitelist-pattern" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
15+
</xsd:sequence>
1516

1617
<xsd:attribute name="username" type="xsd:string" />
1718
<xsd:attribute name="password" type="xsd:string" />

Resources/config/swiftmailer.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363

6464
<service id="swiftmailer.plugin.redirecting" class="%swiftmailer.plugin.redirecting.class%" public="false">
6565
<argument>%swiftmailer.single_address%</argument>
66+
<argument>%swiftmailer.delivery_whitelist%</argument>
6667
</service>
6768

6869
<service id="swiftmailer.plugin.antiflood" class="%swiftmailer.plugin.antiflood.class%" public="false">
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?php
2+
$container->loadFromExtension('swiftmailer', array(
3+
'antiflood' => true
4+
));
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?php
2+
$container->loadFromExtension('swiftmailer', array());
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
$container->loadFromExtension('swiftmailer', array(
3+
'transport' => "smtp",
4+
'username' =>"user",
5+
'password' => "pass",
6+
'host' => "example.org",
7+
'port' => "12345",
8+
'encryption' => "tls",
9+
'auth-mode' => "login",
10+
'timeout' => "1000",
11+
'source_ip' => "127.0.0.1",
12+
'logging' => true,
13+
'spool' => array('type' => 'memory'),
14+
'delivery_address' => '[email protected]',
15+
'delivery_whitelist' => array('/foo@.*/', '/.*@bar.com$/'),
16+
));
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?php
2+
$container->loadFromExtension('swiftmailer', array(
3+
'transport' => null
4+
));
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
$container->loadFromExtension('swiftmailer', array(
3+
'delivery_address' => '[email protected]',
4+
'delivery_whitelist' => array('/foo@.*/', '/.*@bar.com$/'),
5+
));
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
$container->loadFromExtension('swiftmailer', array(
3+
'delivery_address' => '[email protected]',
4+
'delivery_whitelist' => array('/foo@.*/'),
5+
));

0 commit comments

Comments
 (0)