Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8686499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:52:01+00:00 2026-06-12T22:52:01+00:00

I have the following code: require ‘net/smtp’ #This method prints the method starttls p

  • 0

I have the following code:

require 'net/smtp'

#This method prints the method "starttls"
p Net::SMTP.instance_methods

#And here I get an error of unknown method
Net::SMTP.starttls

Net::SMTP.start('smtp.gmail.com', 587, 'mypassword') do |smtp|
smtp.open_message_stream('from@example.com', ['to@example.com']) do |f|
  f.puts 'From: from@example.com'
  f.puts 'To: to@example.com'
  f.puts 'Subject: My Subject!'
  f.puts 'Test subject.'
end

After showing that the method starttls is available in the list of instance methods of Net::SMTP.instance_methods I get the following error:

["starttls", "ready", "enable_starttls", "ssl?", "open_timeout", "capable_cram_md5_auth?", "tls?", "capable_plain_auth?", "data", "inspect", "disable_starttls", "rcptto", "starttls_auto?", "mailfrom", "open_timeout=", "capable_auth_types", "auth_cram_md5", "authenticate", "quit", "send_message", "rcptto_list", "set_debug_output", "esmtp=", "starttls?", "esmtp", "auth_plain", "debug_output=", "starttls_always?", "auth_login", "started?", "read_timeout", "capable_starttls?", "enable_tls", "finish", "open_message_stream", "enable_starttls_auto", "send_mail", "start", "address", "port", "sendmail", "esmtp?", "disable_tls", "helo", "read_timeout=", "disable_ssl", "capable_login_auth?", "ehlo", "enable_ssl", "handle_different_imports", "include_class", "java_kind_of?", "java_signature", "methods", "freeze", "extend", "==", "nil?", "object_id", "method", "tainted?", "is_a?", "instance_variable_get", "instance_variable_defined?", "instance_variable_set", "hash", "display", "send", "private_methods", "enum_for", "equal?", "com", "to_java", "type", "instance_of?", "id", "taint", "class", "java_annotation", "instance_variables", "to_s", "org", "to_a", "__send__", "=~", "protected_methods", "__id__", "java_implements", "tap", "frozen?", "java", "respond_to?", "instance_eval", "===", "java_package", "untaint", "clone", "java_name", "to_enum", "singleton_methods", "eql?", "instance_exec", "dup", "kind_of?", "java_require", "javax", "public_methods"]

NoMethodError: undefined method `starttls' for Net::SMTP:Class

Thoughts?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T22:52:02+00:00Added an answer on June 12, 2026 at 10:52 pm

    I think that your problem is that you are trying to call “starttls” as a static method and not instance method.
    Please first define a new SMTP client and then call its “starttls” method.

    smtp_client = Net::SMTP.new('address')
    smtp_client.starttls
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: require 'rubygems' require 'net/http' require 'uri' url = URI.parse('http://servername.tld/up.txt')
I have the following Ruby code: require 'net/http' require 'uri' include Net $DEBUG =
i have the following code: var net = require('net'); var server = net.createServer(function (stream)
I have the following code require 'test_helper' class ApplicationControllerTest < ActionController::TestCase test should display
I have the following node.js server-side code: var app = require('http').createServer(handler) , io =
I have the following code: index.jsp: <form name=f action=db/ajoutConducteur.jsp method=post> <input type=text pattern=\d{8} required
I have following code for loading image from url in xml parsing endElement method
I have the following code ( from a Ruby tutorial ): require 'thread' count1
I have the following code: #!/usr/bin/ruby require 'socket' server = '221.186.184.68' if ( server
Sometimes I have seen following code. gem 'factory_girl','= 1.2.3' require 'factory_girl' I tried to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.