= Net::SMTP.new('192.168.11.22', 587) context = OpenSSL::SSL::SSLContext.new context.set_params(verify_mode: OpenSSL::SSL::VERIFY_PEER) smtp.enable_starttls(context) smtp.start('client.example.com', 'username', 'password') #=> hostname "192.168.11.22" does not match the server # certificate (OpenSSL::SSL::SSLError) 23