Class: Malm::SMTPServer
- Inherits:
-
GServer
- Object
- GServer
- Malm::SMTPServer
- Defined in:
- lib/malm/smtp_server.rb
Instance Attribute Summary collapse
-
#mail_log ⇒ Object
Returns the value of attribute mail_log.
-
#message_db ⇒ Object
Returns the value of attribute message_db.
Instance Method Summary collapse
Instance Attribute Details
#mail_log ⇒ Object
Returns the value of attribute mail_log.
7 8 9 |
# File 'lib/malm/smtp_server.rb', line 7 def mail_log @mail_log end |
#message_db ⇒ Object
Returns the value of attribute message_db.
8 9 10 |
# File 'lib/malm/smtp_server.rb', line 8 def @message_db end |
Instance Method Details
#db_insert(message) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/malm/smtp_server.rb', line 29 def db_insert() = {:subject => .subject, :from => .mail_from, :to => .rcpt_to, :body => .email_body} @mail_log_fd.puts(.inspect) if @mail_log_fd @message_db.create() if @message_db end |
#serve(io) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/malm/smtp_server.rb', line 10 def serve(io) = Message.new io.print .process_line[:output] loop do data = io.gets response = .process_line(data) io.print response[:output] if response[:output] break if response[:done] break if io.closed? end begin io.close db_insert() rescue => e log "something screwed up..." log e.backtrace end end |