ses-proxy 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/ses_proxy/main_command.rb +9 -5
- data/lib/ses_proxy/smtp_server.rb +1 -1
- metadata +1 -1
@@ -7,7 +7,7 @@ require 'mongoid'
|
|
7
7
|
require 'daemons'
|
8
8
|
require 'tmpdir'
|
9
9
|
|
10
|
-
require '
|
10
|
+
require File.join SesProxy::ROOT, 'app', 'web_panel'
|
11
11
|
|
12
12
|
module SesProxy
|
13
13
|
|
@@ -55,6 +55,8 @@ module SesProxy
|
|
55
55
|
|
56
56
|
option ["-d","--demonize"], :flag, "Demonize application", :default => false
|
57
57
|
|
58
|
+
option ["--pid-dir"], "PID_DIR", "Pid Directory", :default => Dir.tmpdir
|
59
|
+
|
58
60
|
@@env = "development"
|
59
61
|
|
60
62
|
def execute
|
@@ -75,14 +77,14 @@ module SesProxy
|
|
75
77
|
server = Rack::Server.new options
|
76
78
|
|
77
79
|
if demonize?
|
78
|
-
options = {:app_name => "ses_proxy", :dir_mode=>:normal, :dir=>
|
80
|
+
options = {:app_name => "ses_proxy", :dir_mode=>:normal, :dir=>pid_dir, :multiple=>true}
|
79
81
|
group = Daemons::ApplicationGroup.new('ses_proxy', options)
|
80
82
|
options[:mode] = :proc
|
81
83
|
options[:proc] = Proc.new { EM.run{ SesProxy::SmtpServer.start smtp_host, smtp_port } }
|
82
|
-
pid = Daemons::PidFile.new
|
84
|
+
pid = Daemons::PidFile.new pid_dir, "ses_proxy_smtp"
|
83
85
|
@smtp = Daemons::Application.new(group, options, pid)
|
84
86
|
options[:proc] = Proc.new { server.start }
|
85
|
-
pid = Daemons::PidFile.new
|
87
|
+
pid = Daemons::PidFile.new pid_dir, "ses_proxy_http"
|
86
88
|
@http = Daemons::Application.new(group, options, pid)
|
87
89
|
@smtp.start
|
88
90
|
@http.start
|
@@ -136,8 +138,10 @@ module SesProxy
|
|
136
138
|
end
|
137
139
|
|
138
140
|
class StopCommand < Clamp::Command
|
141
|
+
option ["--pid-dir"], "PID_DIR", "Pid Directory", :default => Dir.tmpdir
|
142
|
+
|
139
143
|
def execute
|
140
|
-
options = {:app_name => "ses_proxy", :dir_mode=>:normal, :dir=>
|
144
|
+
options = {:app_name => "ses_proxy", :dir_mode=>:normal, :dir=>pid_dir, :multiple=>true}
|
141
145
|
group = Daemons::ApplicationGroup.new('ses_proxy', options)
|
142
146
|
group.setup
|
143
147
|
group.applications.each do |application|
|
@@ -63,8 +63,8 @@ module SesProxy
|
|
63
63
|
|
64
64
|
def receive_message
|
65
65
|
return false unless verified
|
66
|
-
bounced = Bounce.where({:email=>{"$in"=>recipients}}).map(&:email)
|
67
66
|
mail = Mail.read_from_string(message)
|
67
|
+
bounced = Bounce.where({:email=>{"$in"=>recipients|mail.cc_addrs|mail.bcc_addrs}}).map(&:email)
|
68
68
|
#TODO: Define policy for retry when bounce is not permanent
|
69
69
|
actual_recipients = recipients - bounced
|
70
70
|
actual_cc_addrs = mail.cc_addrs - bounced
|