Here is a sample of a connection attempt to gmail's smtp server:


(Open non-SSL connection to smtp.gmail.com:587)
220 mx.google.com ESMTP t1sm528266poh.2
EHLO localhost
250-mx.google.com at your service, [24.67.129.81]
250-SIZE 35651584
250-8BITMIME
250-STARTTLS
250 ENHANCEDSTATUSCODES

STARTTLS
220 2.0.0 Ready to start TLS
EHLO localhost
(Server disconnects immediately)

Everything up to the last 220 matches the RFC you posted, but I can't find any documentation regarding this part:

S: <waits for connection on TCP port 25>
C: <opens connection>
S: 220 mail.imc.org SMTP service ready
C: EHLO mail.ietf.org
S: 250-mail.imc.org offers a warm hug of welcome
S: 250 STARTTLS
C: STARTTLS
S: 220 Go ahead

C: <starts TLS negotiation>
C & S: <negotiate a TLS session>
C & S: <check result of negotiation>


If anyone can point me to the information to complete the TLS negotiation, I should be able to get my code working.

-genius_at_work