Module: SMTP

Defined in:
lib/drillmail/smtp.rb

Defined Under Namespace

Classes: Session

Class Method Summary collapse

Class Method Details

.listen(port, session_klass: SMTP::Session, host: '127.0.0.1') ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/drillmail/smtp.rb', line 14

def listen(port, session_klass: SMTP::Session, host: '127.0.0.1')
  @server = TCPServer.new port
  puts "Listening on: #{port}"
  loop do
    Thread.start(session_klass.new(@server.accept, host)) do |session|
      session.run
    end
  end
end