aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2016-01-27 10:31:26 +0100
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2016-01-27 10:31:26 +0100
commiteedf5d3d6a164ab123c51b0632ba0d8e5f94862d (patch)
tree5adc0efb1665fb116f06b6179ff4ace6b8de4546
parent3c1ef08adc462ab0be0c6fda5735a0a66f249d0d (diff)
downloadMail-eedf5d3d6a164ab123c51b0632ba0d8e5f94862d.zip
Mail-eedf5d3d6a164ab123c51b0632ba0d8e5f94862d.tar.gz
Mail-eedf5d3d6a164ab123c51b0632ba0d8e5f94862d.tar.bz2
SMTP: Support SMTPS.
SMTPS uses the port number 465. It avoids the use of `STARTTLS` and forces TLS directly. So if we use the 465 port, we enable encryption with TLS.
-rw-r--r--Transport/Smtp.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/Transport/Smtp.php b/Transport/Smtp.php
index e311e44..39b82db 100644
--- a/Transport/Smtp.php
+++ b/Transport/Smtp.php
@@ -242,6 +242,11 @@ class Smtp implements ITransport\Out
$client->connect();
$client->setStreamBlocking(true);
$client->setStreamTimeout(5 * 60);
+ $port = $client->getSocket()->getPort();
+
+ if (465 === $port) {
+ $client->enableEncryption(true, $client::ENCRYPTION_TLS);
+ }
$this->ifNot(
220,
@@ -258,7 +263,7 @@ class Smtp implements ITransport\Out
'The server timed out while answering to a `EHLO` command.'
);
- if (true === in_array('STARTTLS', $ehlo)) {
+ if (465 !== $port && true === in_array('STARTTLS', $ehlo)) {
$client->writeAll('STARTTLS' . CRLF);
$this->ifNot(