ashleymoran / mailtrap forked from mmower/mailtrap

A mock SMTP server for use in Rails development.

This URL has Read+Write access

mailtrap / bin / mailtrap
100755 28 lines (24 sloc) 0.718 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env ruby
#
# Run the mailtrap server
#
 
require 'rubygems'
require 'daemons'
require 'mailtrap'
 
opts = Trollop::options do
  opt :host, "The host SMTP clients will connect to", :default => 'localhost'
  opt :port, "The port SMTP clients will connect to", :default => 2525
  opt :once, "Whether to terminate after serving the first client", :default => false
  opt :file, "File where messages get written", :default => "/var/tmp/mailtrap.log"
end
 
options = {
  :dir_mode => :normal,
  :dir => '/var/tmp',
  :multiple => true,
  :mode => :exec,
  :backtrace => true,
  :log_output => true
}
 
Daemons.run_proc( 'mailtrap', options ) do
  Mailtrap.new( opts[:host], opts[:port], opts[:once], opts[:file] )
end