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

Allow specifying timeout and source_ip parameters for SMTP transport #14

Merged
merged 1 commit into from
Jul 3, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public function getConfigTreeBuilder()
->scalarNode('password')->defaultNull()->end()
->scalarNode('host')->defaultValue('localhost')->end()
->scalarNode('port')->defaultFalse()->end()
->scalarNode('timeout')->defaultValue(30)->end()
->scalarNode('source_ip')->defaultNull()->end()
->scalarNode('encryption')
->defaultNull()
->validate()
Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/SwiftmailerExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function load(array $configs, ContainerBuilder $container)
$config['port'] = 'ssl' === $config['encryption'] ? 465 : 25;
}

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

Expand Down
2 changes: 2 additions & 0 deletions Resources/config/schema/swiftmailer-1.0.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
<xsd:attribute name="port" type="xsd:string" />
<xsd:attribute name="encryption" type="encryption" />
<xsd:attribute name="auth-mode" type="auth_mode" />
<xsd:attribute name="timeout" type="xsd:string"/>
<xsd:attribute name="source-ip" type="xsd:string"/>
<xsd:attribute name="transport" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="delivery-address" type="xsd:string" />
Expand Down
2 changes: 2 additions & 0 deletions Resources/config/smtp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
<call method="setUsername"><argument>%swiftmailer.transport.smtp.username%</argument></call>
<call method="setPassword"><argument>%swiftmailer.transport.smtp.password%</argument></call>
<call method="setAuthMode"><argument>%swiftmailer.transport.smtp.auth_mode%</argument></call>
<call method="setTimeout"><argument>%swiftmailer.transport.smtp.timeout%</argument></call>
<call method="setSourceIp"><argument>%swiftmailer.transport.smtp.source_ip%</argument></call>
</service>
</services>
</container>