class Net::SMTP::Response

{Section 4.2 of RFC 5321}[http://tools.ietf.org/html/rfc5321#section-4.2]
created by the user. For more information on SMTP responses, view
of this class are created by the SMTP class; they should not be directly
This class represents a response received by the SMTP server. Instances

def self.parse(str)

readable reply text
Parses the received response and separates the reply code and the human
def self.parse(str)
  new(str[0,3], str)
end

def capabilities

thereafter being a value in the array
hash is the first word the value of the hash is an array with each word
is multiple lines. It does not return the first line. The key of the
Returns a hash of the human readable reply text in the response if it
def capabilities
  return {} unless @string[3, 1] == '-'
  h = {}
  @string.lines.drop(1).each do |line|
    k, *v = line[4..-1].split(' ')
    h[k] = v
  end
  h
end

def continue?

reply (3xx reply code)
Determines whether the response received was a Positive Intermediate
def continue?
  status_type_char() == '3'
end

def cram_md5_challenge

on Wikipedia: https://en.wikipedia.org/wiki/CRAM-MD5
Creates a CRAM-MD5 challenge. You can view more information on CRAM-MD5
def cram_md5_challenge
  @string.split(/ /)[1].unpack1('m')
end

def exception_class

based on the reply code of the response
Determines whether there was an error and raises the appropriate error
def exception_class
  case @status
  when /\A4/  then SMTPServerBusy
  when /\A50/ then SMTPSyntaxError
  when /\A53/ then SMTPAuthenticationError
  when /\A5/  then SMTPFatalError
  else             SMTPUnknownError
  end
end

def initialize(status, string)

string attributes
Creates a new instance of the Response class and sets the status and
def initialize(status, string)
  @status = status
  @string = string
end

def message

The first line of the human readable reply text
def message
  @string.lines.first
end

def status_type_char

Takes the first digit of the reply code to determine the status type
def status_type_char
  @status[0, 1]
end

def success?

reply (2xx reply code)
Determines whether the response received was a Positive Completion
def success?
  status_type_char() == '2'
end