aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2015-06-11 09:35:23 +0200
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2015-06-11 09:35:23 +0200
commit8d5e144d5438aafe9b7b87026990cfbc263e4788 (patch)
tree36a2963ccc77d36c7094981a8f25001871f5f6e3
parent723069d3813bf7afffe2a7bf143b23cafcd149aa (diff)
downloadMail-8d5e144d5438aafe9b7b87026990cfbc263e4788.zip
Mail-8d5e144d5438aafe9b7b87026990cfbc263e4788.tar.gz
Mail-8d5e144d5438aafe9b7b87026990cfbc263e4788.tar.bz2
Avoid sending a second `EHLO` if no `STARTTLS`.
In the case the server does not support `STARTTLS`, we always re-sent a new `EHLO`. While this operation is mandatory (see RFC3207, Section 4.2) if we switched to TLS, it is totally useless in the case no `STARTTLS` command has been sent. So move the new `EHLO` in the `STARTTLS` block. It will speed mail sending in the case `STARTTLS` is not supported by the server.
-rw-r--r--Transport/Smtp.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/Transport/Smtp.php b/Transport/Smtp.php
index c854869..2d4d7b8 100644
--- a/Transport/Smtp.php
+++ b/Transport/Smtp.php
@@ -226,10 +226,11 @@ class Smtp implements ITransport\Out
1
);
}
+
+ $client->writeAll('EHLO ' . $domain . CRLF);
+ $ehlo = preg_split('#' . CRLF . '250[\-\s]+#', $client->read(2048));
}
- $client->writeAll('EHLO ' . $domain . CRLF);
- $ehlo = preg_split('#' . CRLF . '250[\-\s]+#', $client->read(2048));
$matches = null;
foreach ($ehlo as $entry) {