title: When connecting to SMTP servers should I try SSL or TCP/STARTTLS first?
body: <p>SMTP allows unecrypted communication over port 25. For some servers (like Google's MX servers) I'm able to switch to a TLS connection using STARTTLS after making the initial unencrypted connection.</p>
  
  <pre><code>S:220 mx.google.com ESMTP l1si352658een.133
  C:EHLO mail.example.com
  S:250-mx.google.com at your service
  S:250-SIZE 35882577
  S:250-8BITMIME
  S:250-STARTTLS
  S:250-ENHANCEDSTATUSCODES
  S:250 PIPELINING
  C:STARTTLS
  S:220 2.0.0 Ready to start TLS
  [socket switches to TLS here]
  C:EHLO mail.example.com
  ...
  </code></pre>
  
  <p>However, I would also like to support straight SSL connections and I'm wondering whether most mail servers prefer starting with SSL or starting with TCP and then moving to TLS after a connection is made.</p>