This repository has been archived by the owner on Feb 6, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow multilple delivery_address addresses
- Loading branch information
Showing
6 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,7 +111,17 @@ private function getMailersNode() | |
->end() | ||
->end() | ||
->scalarNode('sender_address')->end() | ||
->scalarNode('delivery_address')->end() | ||
->variableNode('delivery_address') | ||
->info('Forces the to: header can be a single email "[email protected]" or an array of delivery addresses') | ||
->validate() | ||
->ifTrue( | ||
function ($value) { | ||
return !is_array($value) && !is_string($value); | ||
} | ||
) | ||
->thenInvalid('Delivery address must be either an array of email addresses or a singe email address.') | ||
->end() | ||
->end() | ||
->arrayNode('antiflood') | ||
->children() | ||
->scalarNode('threshold')->defaultValue(99)->end() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
Tests/DependencyInjection/Fixtures/config/php/redirect_multi.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php | ||
$container->loadFromExtension('swiftmailer', array( | ||
'delivery_address' => array('[email protected]', '[email protected]') | ||
)); |
12 changes: 12 additions & 0 deletions
12
Tests/DependencyInjection/Fixtures/config/xml/redirect_multi.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<container xmlns="http://symfony.com/schema/dic/services" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:swiftmailer="http://symfony.com/schema/dic/swiftmailer" | ||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd | ||
http://symfony.com/schema/dic/swiftmailer http://symfony.com/schema/dic/swiftmailer/swiftmailer-1.0.xsd"> | ||
|
||
<swiftmailer:config> | ||
<swiftmailer:delivery-address>[email protected]</swiftmailer:delivery-address> | ||
<swiftmailer:delivery-address>[email protected]</swiftmailer:delivery-address> | ||
</swiftmailer:config> | ||
</container> |
2 changes: 2 additions & 0 deletions
2
Tests/DependencyInjection/Fixtures/config/yml/redirect_multi.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
swiftmailer: | ||
delivery_address: [[email protected], [email protected]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -251,6 +251,17 @@ public function testSingleRedirectionConfig($type) | |
$this->assertEquals(array('/foo@.*/'), $container->getParameter('swiftmailer.mailer.default.delivery_whitelist')); | ||
} | ||
|
||
/** | ||
* @dataProvider getConfigTypes | ||
*/ | ||
public function testMultiRedirectionConfig($type) | ||
{ | ||
$container = $this->loadContainerFromFile('redirect_multi', $type); | ||
|
||
$this->assertSame(array('swiftmailer.default.plugin' => array(array())), $container->getDefinition('swiftmailer.mailer.default.plugin.redirecting')->getTags()); | ||
$this->assertSame(array('[email protected]', '[email protected]'), $container->getParameter('swiftmailer.mailer.default.single_address')); | ||
} | ||
|
||
/** | ||
* @dataProvider getConfigTypes | ||
*/ | ||
|