aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/smtp
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2006-10-02 21:51:27 +0200
committerVincent Richard <[email protected]>2006-10-02 21:51:27 +0200
commitb2d67de8a9cf7e97fb592742e57c0dae249e65b2 (patch)
tree89e1b7d04969d1996b2cdcd2303197e482ef3bed /src/net/smtp
parentFixed typo. (diff)
downloadvmime-b2d67de8a9cf7e97fb592742e57c0dae249e65b2.tar.gz
vmime-b2d67de8a9cf7e97fb592742e57c0dae249e65b2.zip
Reissue EHLO after successful STARTTLS.
Diffstat (limited to 'src/net/smtp')
-rw-r--r--src/net/smtp/SMTPTransport.cpp72
1 files changed, 42 insertions, 30 deletions
diff --git a/src/net/smtp/SMTPTransport.cpp b/src/net/smtp/SMTPTransport.cpp
index 98a2c9ee..07da0e4c 100644
--- a/src/net/smtp/SMTPTransport.cpp
+++ b/src/net/smtp/SMTPTransport.cpp
@@ -135,36 +135,7 @@ void SMTPTransport::connect()
}
// Identification
- // First, try Extended SMTP (ESMTP)
- //
- // eg: C: EHLO thismachine.ourdomain.com
- // S: 250-smtp.theserver.com
- // S: 250 AUTH CRAM-MD5 DIGEST-MD5
-
- sendRequest("EHLO " + platformDependant::getHandler()->getHostName());
-
- if ((resp = readResponse())->getCode() != 250)
- {
- // Next, try "Basic" SMTP
- //
- // eg: C: HELO thismachine.ourdomain.com
- // S: 250 OK
-
- sendRequest("HELO " + platformDependant::getHandler()->getHostName());
-
- if ((resp = readResponse())->getCode() != 250)
- {
- internalDisconnect();
- throw exceptions::connection_greeting_error(resp->getLastLine().getText());
- }
-
- m_extendedSMTP = false;
- }
- else
- {
- m_extendedSMTP = true;
- m_extendedSMTPResponse = resp->getText();
- }
+ helo();
#if VMIME_HAVE_TLS_SUPPORT
// Setup secured connection, if requested
@@ -196,6 +167,9 @@ void SMTPTransport::connect()
{
throw;
}
+
+ // Must reissue a EHLO command [RFC-2487, 5.2]
+ helo();
}
#endif // VMIME_HAVE_TLS_SUPPORT
@@ -207,6 +181,44 @@ void SMTPTransport::connect()
}
+void SMTPTransport::helo()
+{
+ // First, try Extended SMTP (ESMTP)
+ //
+ // eg: C: EHLO thismachine.ourdomain.com
+ // S: 250-smtp.theserver.com
+ // S: 250 AUTH CRAM-MD5 DIGEST-MD5
+
+ sendRequest("EHLO " + platformDependant::getHandler()->getHostName());
+
+ ref <SMTPResponse> resp;
+
+ if ((resp = readResponse())->getCode() != 250)
+ {
+ // Next, try "Basic" SMTP
+ //
+ // eg: C: HELO thismachine.ourdomain.com
+ // S: 250 OK
+
+ sendRequest("HELO " + platformDependant::getHandler()->getHostName());
+
+ if ((resp = readResponse())->getCode() != 250)
+ {
+ internalDisconnect();
+ throw exceptions::connection_greeting_error(resp->getLastLine().getText());
+ }
+
+ m_extendedSMTP = false;
+ m_extendedSMTPResponse.clear();
+ }
+ else
+ {
+ m_extendedSMTP = true;
+ m_extendedSMTPResponse = resp->getText();
+ }
+}
+
+
void SMTPTransport::authenticate()
{
if (!m_extendedSMTP)