Exception: Groat::SMTPD::SMTPResponse

Inherits:
Response
  • Object
show all
Defined in:
lib/groat/smtpd/smtpsyntax.rb

Instance Method Summary collapse

Methods inherited from Response

#terminate?

Constructor Details

#initialize(args = {}) ⇒ SMTPResponse

Returns a new instance of SMTPResponse.



34
35
36
37
# File 'lib/groat/smtpd/smtpsyntax.rb', line 34

def initialize(args = {})
  @code = args[:code] || 500
  super(args)
end

Instance Method Details

#reply_textObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/groat/smtpd/smtpsyntax.rb', line 39

def reply_text
  text = ""
  if @message.is_a? Array
    last = @message.pop
    if @message.count > 0
      @message.each do |line|
        text << @code.to_s + "-#{line}\r\n"
      end
    end
    text << @code.to_s + " #{last}\r\n"
  else
    text << @code.to_s + " #{@message}\r\n"
  end
end