Class: Minbox::Data

Inherits:
Object
  • Object
show all
Defined in:
lib/minbox/client.rb

Instance Method Summary collapse

Instance Method Details

#run(client, _line) {|Mail.new(body.join)| ... } ⇒ Object

Yields:

  • (Mail.new(body.join))


37
38
39
40
41
42
43
44
45
46
47
# File 'lib/minbox/client.rb', line 37

def run(client, _line)
  client.write '354 End data with <CR><LF>.<CR><LF>'
  body = []
  line = client.read
  until line.nil? || line.match(/^\.\r\n$/)
    body << line
    line = client.read
  end
  client.write '250 OK'
  yield(Mail.new(body.join)) unless body.empty?
end