Class: DataCommand
- Inherits:
-
Struct
- Object
- Struct
- DataCommand
- Defined in:
- lib/drillmail/commands/data.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#session ⇒ Object
Returns the value of attribute session.
Instance Method Summary collapse
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body
4 5 6 |
# File 'lib/drillmail/commands/data.rb', line 4 def body @body end |
#session ⇒ Object
Returns the value of attribute session
4 5 6 |
# File 'lib/drillmail/commands/data.rb', line 4 def session @session end |
Instance Method Details
#call ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/drillmail/commands/data.rb', line 5 def call if session.reverse_path and session.forward_path session.connection.puts session.reply(354) while line = session.connection.gets and not line =~ /^(\r\n)?\.\r\n$/ puts "Recieved #{line}" session..push(line) end mail = Mail.new(session..join) puts "writing to #{mail.to.last}/#{mail.}.eml" # this could be dangerous as fake messages could flood in # as we would just be committing them all to disk. Should do this # async? File.open("./#{mail.to.last}/#{mail.}.eml", 'w') do |f| f.write(mail) end session.reply(250) else session.reply(451) end end |