class Tegawa::MailServer
Public Class Methods
new(addr, port)
click to toggle source
Calls superclass method
# File lib/tegawa/mail_server.rb, line 8 def initialize(addr, port) super(port, addr) @queue = Tegawa.queue @logger = Tegawa.logger end
Public Instance Methods
on_message_data_event(ctx)
click to toggle source
# File lib/tegawa/mail_server.rb, line 18 def on_message_data_event(ctx) # Output for debug @logger.debug("mail reveived at: [#{ctx[:server][:local_ip]}:#{ctx[:server][:local_port]}] from: [#{ctx[:envelope][:from]}] for recipient(s): [#{ctx[:envelope][:to]}]...") # Just decode message once to make sure, that this message ist readable @mail = Mail.read_from_string(ctx[:message][:data]) # handle incoming mail, just show the message source @logger.info "You've got mail! From: #{@mail.from}" message = "Mail-From: #{@mail.from}\r\nSubject: #{@mail.subject}\r\n\r\n#{@mail.body}" @queue << message end
start()
click to toggle source
Calls superclass method
# File lib/tegawa/mail_server.rb, line 14 def start super end