class Net::SMTP::Authenticator

def self.auth_class(type)

def self.auth_class(type)
  type = type.to_s.upcase.tr(?_, ?-).to_sym
  Authenticator.auth_classes[type]
end

def self.auth_classes

def self.auth_classes
  @classes ||= {}
end

def self.auth_type(type)

def self.auth_type(type)
  type = type.to_s.upcase.tr(?_, ?-).to_sym
  Authenticator.auth_classes[type] = self
end

def self.check_args(user_arg = nil, secret_arg = nil, *, **)

def self.check_args(user_arg = nil, secret_arg = nil, *, **)
  unless user_arg
    raise ArgumentError, 'SMTP-AUTH requested but missing user name'
  end
  unless secret_arg
    raise ArgumentError, 'SMTP-AUTH requested but missing secret phrase'
  end
end

def base64_encode(str)

Returns:
  • (String) - Base64 encoded string

Parameters:
  • str (String) --
def base64_encode(str)
  # expects "str" may not become too long
  [str].pack('m0')
end

def continue(arg)

Returns:
  • (String) - message from server

Parameters:
  • arg (String) -- message to server
def continue(arg)
  res = smtp.get_response arg
  raise res.exception_class.new(res) unless res.continue?
  res.string.split[1]
end

def finish(arg)

Returns:
  • (Net::SMTP::Response) - response from server

Parameters:
  • arg (String) -- message to server
def finish(arg)
  res = smtp.get_response arg
  raise SMTPAuthenticationError.new(res) unless res.success?
  res
end

def initialize(smtp)

def initialize(smtp)
  @smtp = smtp
end