class Net::IMAP
def starttls(**options)
Cached #capabilities will be cleared when this method completes.
Server capabilities may change after #starttls, #login, and #authenticate.
+STARTTLS+ capability.
Clients should not call #starttls unless the server advertises the
===== Capability
Related: Net::IMAP.new, #login, #authenticate
with the response (e.g. CAPABILITY) is insecure and cannot be trusted.
TLS starts immediately _after_ that response. Any response code sent
TaggedResponse to STARTTLS is sent clear-text, _before_ TLS negotiation.
Any #response_handlers added before STARTTLS should be aware that the
>>>
*Note:*
secured.
both successful. Any error indicates that the connection has not been
This method returns after TLS negotiation and hostname verification are
See DeprecatedClientOptions#starttls for deprecated arguments.
SSLContext[https://docs.ruby-lang.org/en/master/OpenSSL/SSL/SSLContext.html].
the keys are names of attribute assignment methods on
{OpenSSL::SSL::SSLContext#set_params}[https://docs.ruby-lang.org/en/master/OpenSSL/SSL/SSLContext.html#method-i-set_params];
Any +options+ are forwarded directly to
to start a TLS session.
Sends a {STARTTLS command [IMAP4rev1 ยง6.2.1]}[https://www.rfc-editor.org/rfc/rfc3501#section-6.2.1]
def starttls(**options) @ssl_ctx_params, @ssl_ctx = build_ssl_ctx(options) send_command("STARTTLS") do |resp| if resp.kind_of?(TaggedResponse) && resp.name == "OK" clear_cached_capabilities clear_responses start_tls_session end end end