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

Commit 880706f

Browse files
committed
Merge pull request #14 from lstrojny/smtp-additional-parameters
Allow specifying timeout and source_ip parameters for SMTP transport
2 parents 8e4d1ee + 971f4b1 commit 880706f

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-1
lines changed

DependencyInjection/Configuration.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ public function getConfigTreeBuilder()
5353
->scalarNode('password')->defaultNull()->end()
5454
->scalarNode('host')->defaultValue('localhost')->end()
5555
->scalarNode('port')->defaultFalse()->end()
56+
->scalarNode('timeout')->defaultValue(30)->end()
57+
->scalarNode('source_ip')->defaultNull()->end()
5658
->scalarNode('encryption')
5759
->defaultNull()
5860
->validate()

DependencyInjection/SwiftmailerExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function load(array $configs, ContainerBuilder $container)
7676
$config['port'] = 'ssl' === $config['encryption'] ? 465 : 25;
7777
}
7878

79-
foreach (array('encryption', 'port', 'host', 'username', 'password', 'auth_mode') as $key) {
79+
foreach (array('encryption', 'port', 'host', 'username', 'password', 'auth_mode', 'timeout', 'source_ip') as $key) {
8080
$container->setParameter('swiftmailer.transport.smtp.'.$key, $config[$key]);
8181
}
8282

Resources/config/schema/swiftmailer-1.0.xsd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
<xsd:attribute name="port" type="xsd:string" />
2020
<xsd:attribute name="encryption" type="encryption" />
2121
<xsd:attribute name="auth-mode" type="auth_mode" />
22+
<xsd:attribute name="timeout" type="xsd:string"/>
23+
<xsd:attribute name="source-ip" type="xsd:string"/>
2224
<xsd:attribute name="transport" type="xsd:string" />
2325
<xsd:attribute name="type" type="xsd:string" />
2426
<xsd:attribute name="delivery-address" type="xsd:string" />

Resources/config/smtp.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
<call method="setUsername"><argument>%swiftmailer.transport.smtp.username%</argument></call>
2323
<call method="setPassword"><argument>%swiftmailer.transport.smtp.password%</argument></call>
2424
<call method="setAuthMode"><argument>%swiftmailer.transport.smtp.auth_mode%</argument></call>
25+
<call method="setTimeout"><argument>%swiftmailer.transport.smtp.timeout%</argument></call>
26+
<call method="setSourceIp"><argument>%swiftmailer.transport.smtp.source_ip%</argument></call>
2527
</service>
2628
</services>
2729
</container>

0 commit comments

Comments
 (0)