Class: Net::SMTP

Inherits:
Object show all
Defined in:
lib/mail/core_extensions/smtp.rb

Instance Method Summary collapse

Instance Method Details

#tlsconnect(s) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/mail/core_extensions/smtp.rb', line 10

def tlsconnect(s)
  verified = false
  s = OpenSSL::SSL::SSLSocket.new s, @ssl_context
  logging "TLS connection started"
  s.sync_close = true
  s.connect
  if @ssl_context.verify_mode != OpenSSL::SSL::VERIFY_NONE
    s.post_connection_check(@address)
  end
  verified = true
  s
ensure
  s.close unless verified
end