Module: MailCatcher

Defined in:
lib/mail_catcher.rb,
lib/mail_catcher/smtp.rb,
lib/mail_catcher/events.rb,
lib/mail_catcher/web.rb

Defined Under Namespace

Modules: Events, Mail Classes: Smtp, Web

Class Method Summary collapse

Class Method Details

.run(options = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/mail_catcher.rb', line 10

def self.run(options = {})
  options[:smtp_ip] ||= '127.0.0.1'
  options[:smtp_port] ||= 1025
  options[:http_ip] ||= '127.0.0.1'
  options[:http_port] ||= 1080
  
  puts "Starting MailCatcher"
  puts "==> smtp://#{options[:smtp_ip]}:#{options[:smtp_port]}"
  puts "==> http://#{options[:http_ip]}:#{options[:http_port]}"

  Thin::Logging.silent = true
  EventMachine.run do
    EventMachine.start_server options[:smtp_ip], options[:smtp_port], Smtp
    Thin::Server.start options[:http_ip], options[:http_port], Web
  end
end