Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitba98fd7

Browse files
committed
feature#37432 [Mailer] Implement additional mailer transport options (fritzmg)
This PR was squashed before being merged into the 5.2-dev branch.Discussion----------[Mailer] Implement additional mailer transport options| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | yes| Deprecations? | no| Tickets |Fix#37300| License | MIT| Doc PR |symfony/symfony-docs#13911This implements additional transport configuration options mentioned in#37300. It also adds a `command` option to be able to define the command used by the `sendmail` transport.Examples:```ymlframework: mailer: transports: sendmail: sendmail://default?command=/usr/sbin/sendmail%%20-oi%%20-t local_domain: smtps://smtp.example.com?local_domain=example.org restart_threshold: smtps://smtp.example.com?restart_threshold=10&restart_threshold_sleep=1 ping_threshold: smtps://smtp.example.com?ping_threshold=200```Commits-------665d1cd [Mailer] Implement additional mailer transport options
2 parentsdf84e22 +665d1cd commitba98fd7

File tree

5 files changed

+44
-1
lines changed

5 files changed

+44
-1
lines changed

‎src/Symfony/Component/Mailer/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ CHANGELOG
55
-----
66

77
* added`NativeTransportFactory` to configure a transport based on php.ini settings
8+
* added`local_domain`,`restart_threshold`,`restart_threshold_sleep` and`ping_threshold` options for`smtp`
9+
* added`command` option for`sendmail`
810

911
4.4.0
1012
-----

‎src/Symfony/Component/Mailer/Tests/Transport/SendmailTransportFactoryTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ public function createProvider(): iterable
3838
newDsn('sendmail+smtp','default'),
3939
newSendmailTransport(null,$this->getDispatcher(),$this->getLogger()),
4040
];
41+
42+
yield [
43+
newDsn('sendmail+smtp','default',null,null,null, ['command' =>'/usr/sbin/sendmail -oi -t']),
44+
newSendmailTransport('/usr/sbin/sendmail -oi -t',$this->getDispatcher(),$this->getLogger()),
45+
];
4146
}
4247

4348
publicfunctionunsupportedSchemeProvider():iterable

‎src/Symfony/Component/Mailer/Tests/Transport/Smtp/EsmtpTransportFactoryTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,29 @@ public function createProvider(): iterable
8181
newDsn('smtps','example.com','','',465, ['verify_peer' =>false]),
8282
$transport,
8383
];
84+
85+
$transport =newEsmtpTransport('example.com',465,true,$eventDispatcher,$logger);
86+
$transport->setLocalDomain('example.com');
87+
88+
yield [
89+
newDsn('smtps','example.com','','',465, ['local_domain' =>'example.com']),
90+
$transport,
91+
];
92+
93+
$transport =newEsmtpTransport('example.com',465,true,$eventDispatcher,$logger);
94+
$transport->setRestartThreshold(10,1);
95+
96+
yield [
97+
newDsn('smtps','example.com','','',465, ['restart_threshold' =>'10','restart_threshold_sleep' =>'1']),
98+
$transport,
99+
];
100+
101+
$transport =newEsmtpTransport('example.com',465,true,$eventDispatcher,$logger);
102+
$transport->setPingThreshold(10);
103+
104+
yield [
105+
newDsn('smtps','example.com','','',465, ['ping_threshold' =>'10']),
106+
$transport,
107+
];
84108
}
85109
}

‎src/Symfony/Component/Mailer/Transport/SendmailTransportFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ final class SendmailTransportFactory extends AbstractTransportFactory
2121
publicfunctioncreate(Dsn$dsn):TransportInterface
2222
{
2323
if ('sendmail+smtp' ===$dsn->getScheme() ||'sendmail' ===$dsn->getScheme()) {
24-
returnnewSendmailTransport(null,$this->dispatcher,$this->logger);
24+
returnnewSendmailTransport($dsn->getOption('command'),$this->dispatcher,$this->logger);
2525
}
2626

2727
thrownewUnsupportedSchemeException($dsn,'sendmail',$this->getSupportedSchemes());

‎src/Symfony/Component/Mailer/Transport/Smtp/EsmtpTransportFactory.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,18 @@ public function create(Dsn $dsn): TransportInterface
4848
$transport->setPassword($password);
4949
}
5050

51+
if (null !== ($localDomain =$dsn->getOption('local_domain'))) {
52+
$transport->setLocalDomain($localDomain);
53+
}
54+
55+
if (null !== ($restartThreshold =$dsn->getOption('restart_threshold'))) {
56+
$transport->setRestartThreshold((int)$restartThreshold, (int)$dsn->getOption('restart_threshold_sleep',0));
57+
}
58+
59+
if (null !== ($pingThreshold =$dsn->getOption('ping_threshold'))) {
60+
$transport->setPingThreshold((int)$pingThreshold);
61+
}
62+
5163
return$transport;
5264
}
5365

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp