mail_spy 0.0.18 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -30,6 +30,8 @@ Then mount the engine in the routes.rb file
30
30
  mount MailSpy::Engine => "/mail"
31
31
  end
32
32
 
33
+ Finally run rake db:mongoid:create_indexes to get performant sends
34
+
33
35
  == Usage
34
36
 
35
37
  Mailspy is centered around email templates and instances of those templates
@@ -75,6 +75,20 @@ module MailSpy
75
75
  load_template("text.erb")
76
76
  end
77
77
 
78
+
79
+ def deliver
80
+ begin
81
+ MailSpy::CoreMailer.template(self).deliver
82
+ self.update_attribute(:sent, true)
83
+ rescue Exception => e
84
+ self.failed = true
85
+ self.error_message = e.try(:message)
86
+ self.error_backtrace = e.try(:backtrace)
87
+ self.save!
88
+ end
89
+ end
90
+
91
+
78
92
  protected
79
93
 
80
94
  # Loads a template file from s3 using
@@ -99,16 +113,6 @@ module MailSpy
99
113
  end
100
114
 
101
115
 
102
-
103
- #var key_hash = {
104
- # campaign:this.campaign,
105
- # stream:this.stream,
106
- # component:this.component,
107
- # campaign:this.subject
108
- #};
109
- #
110
-
111
-
112
116
  def self.generate_subject_reports
113
117
  map = <<-eof
114
118
  function(){
@@ -4,6 +4,8 @@
4
4
  #
5
5
  # aws credentials: We use aws to store the templates for the emails.
6
6
  #
7
+ # If you have delayed job and want to use it to clear the outstanding emails
8
+ # toggle it on here
7
9
 
8
10
 
9
11
  MailSpy.configure do |config|
@@ -11,6 +13,7 @@ MailSpy.configure do |config|
11
13
  config.aws_access_key_id = "YOUR ACCESS KEY"
12
14
  config.aws_secret_access_key = "YOUR SECRET ACCESS KEY"
13
15
  config.aws_campaign_bucket = "campaigns-yourco-com"
16
+ config.using_delayed_job = true
14
17
  end
15
18
 
16
19
 
data/lib/mail_spy.rb CHANGED
@@ -19,7 +19,7 @@ module MailSpy
19
19
 
20
20
  MailSpyConfig = Struct.new(
21
21
  :tracker_host, :aws_access_key_id,
22
- :aws_secret_access_key, :aws_campaign_bucket
22
+ :aws_secret_access_key, :aws_campaign_bucket, :using_delayed_job
23
23
 
24
24
  )
25
25
  @@config = MailSpyConfig.new
@@ -62,4 +62,8 @@ module MailSpy
62
62
  @@config.aws_campaign_bucket
63
63
  end
64
64
 
65
+ def self.using_delayed_job
66
+ @@config.using_delayed_job
67
+ end
68
+
65
69
  end
@@ -64,6 +64,7 @@ module MailSpy
64
64
 
65
65
  # Enable sendgrid specific enhancements
66
66
  # Must happen after the email has been saved for the id
67
+ # TODO test this works
67
68
  if esp.options[:enable_sendgrid_event_tracking].present?
68
69
  header = MailSpy::Sendgrid::SmtpApiHeader.new
69
70
  header.setUniqueArgs({:eid => email.id.to_s})
@@ -92,7 +93,7 @@ module MailSpy
92
93
  wq = WorkQueue.new(num_threads, step*2)
93
94
  current_time = DateTime.now
94
95
  offset = 0
95
- sent = 0
96
+ processed = 0
96
97
 
97
98
  # Helper function for setting present values
98
99
  def set_if_present(email, pony_hash, pony_key, email_key=nil)
@@ -104,32 +105,24 @@ module MailSpy
104
105
  while true
105
106
  emails = MailSpy::Email.
106
107
  limit(step).offset(offset).asc(:_id).
107
- where(:schedule_at.lte => current_time, :sent => false, :failed => false).
108
- collect
108
+ where(:schedule_at.lte => current_time, :sent => false, :failed => false).all
109
109
  break if emails.count <= 0 #returns enumerator which is never blank
110
110
  emails.each do |email|
111
+ processed += 1
111
112
  wq.enqueue_b do
112
- begin
113
- MailSpy::CoreMailer.template(email).deliver
114
- email.update_attribute(:sent, true)
115
- sent += 1
116
- rescue Exception => e
117
- email.failed = true
118
- email.error_message = e.try(:message)
119
- email.error_backtrace = e.try(:backtrace)
120
- email.save!
121
- end
113
+ MailSpy.using_delayed_job ? email.delay.deliver : email.deliver
122
114
  end
123
115
  end
124
116
 
125
117
  # We must join here otherwise the next loop email lookup will be in a
126
118
  # race condition with the results of our worker_queue.
127
119
  wq.join
120
+
128
121
  offset += step
129
122
  end
130
123
 
131
124
  success = true
132
- return sent
125
+ return processed
133
126
 
134
127
  ensure
135
128
  if current_process
@@ -1,3 +1,3 @@
1
1
  module MailSpy
2
- VERSION = "0.0.18"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -15967,3 +15967,384 @@ MONGODB dummy_test['mail_spy_emails'].remove({})
15967
15967
   (0.1ms) rollback transaction
15968
15968
   (0.1ms) begin transaction
15969
15969
   (0.0ms) rollback transaction
15970
+ MONGODB [WARNING] Please note that logging negatively impacts client-side performance. You should set your logging level no lower than :info in production.
15971
+ MONGODB admin['$cmd'].find({:ismaster=>1}).limit(-1)
15972
+  (0.3ms) begin transaction
15973
+ MONGODB dummy_test['system.namespaces'].find({})
15974
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{}, "fields"=>nil}).limit(-1)
15975
+ MONGODB dummy_test['mail_spy_emails'].remove({})
15976
+  (0.1ms) rollback transaction
15977
+  (0.1ms) begin transaction
15978
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{}, "fields"=>nil}).limit(-1)
15979
+ MONGODB dummy_test['mail_spy_emails'].remove({})
15980
+  (0.0ms) rollback transaction
15981
+  (0.0ms) begin transaction
15982
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{}, "fields"=>nil}).limit(-1)
15983
+ MONGODB dummy_test['mail_spy_emails'].remove({})
15984
+  (0.0ms) rollback transaction
15985
+  (0.0ms) begin transaction
15986
+ MONGODB dummy_test['system.namespaces'].find({})
15987
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_process_logs", "query"=>{}, "fields"=>nil}).limit(-1)
15988
+ MONGODB dummy_test['mail_spy_process_logs'].remove({})
15989
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{}, "fields"=>nil}).limit(-1)
15990
+ MONGODB dummy_test['mail_spy_emails'].remove({})
15991
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_process_logs", "query"=>{}, "fields"=>nil}).limit(-1)
15992
+ MONGODB dummy_test['mail_spy_process_logs'].remove({})
15993
+  (0.1ms) rollback transaction
15994
+  (0.0ms) begin transaction
15995
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_process_logs", "query"=>{}, "fields"=>nil}).limit(-1)
15996
+ MONGODB dummy_test['mail_spy_process_logs'].remove({})
15997
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{}, "fields"=>nil}).limit(-1)
15998
+ MONGODB dummy_test['mail_spy_emails'].remove({})
15999
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_process_logs", "query"=>{}, "fields"=>nil}).limit(-1)
16000
+ MONGODB dummy_test['mail_spy_process_logs'].remove({})
16001
+  (0.1ms) rollback transaction
16002
+  (0.0ms) begin transaction
16003
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_process_logs", "query"=>{}, "fields"=>nil}).limit(-1)
16004
+ MONGODB dummy_test['mail_spy_process_logs'].remove({})
16005
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{}, "fields"=>nil}).limit(-1)
16006
+ MONGODB dummy_test['mail_spy_emails'].remove({})
16007
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_process_logs", "query"=>{}, "fields"=>nil}).limit(-1)
16008
+ MONGODB dummy_test['mail_spy_process_logs'].remove({})
16009
+  (0.0ms) rollback transaction
16010
+  (0.0ms) begin transaction
16011
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_process_logs", "query"=>{}, "fields"=>nil}).limit(-1)
16012
+ MONGODB dummy_test['mail_spy_process_logs'].remove({})
16013
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{}, "fields"=>nil}).limit(-1)
16014
+ MONGODB dummy_test['mail_spy_emails'].remove({})
16015
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_process_logs", "query"=>{}, "fields"=>nil}).limit(-1)
16016
+ MONGODB dummy_test['mail_spy_process_logs'].remove({})
16017
+  (0.0ms) rollback transaction
16018
+  (0.0ms) begin transaction
16019
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_process_logs", "query"=>{}, "fields"=>nil}).limit(-1)
16020
+ MONGODB dummy_test['mail_spy_process_logs'].remove({})
16021
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{}, "fields"=>nil}).limit(-1)
16022
+ MONGODB dummy_test['mail_spy_emails'].remove({})
16023
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_process_logs", "query"=>{}, "fields"=>nil}).limit(-1)
16024
+ MONGODB dummy_test['mail_spy_process_logs'].remove({})
16025
+  (0.0ms) rollback transaction
16026
+  (0.0ms) begin transaction
16027
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_process_logs", "query"=>{}, "fields"=>nil}).limit(-1)
16028
+ MONGODB dummy_test['mail_spy_process_logs'].remove({})
16029
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{}, "fields"=>nil}).limit(-1)
16030
+ MONGODB dummy_test['mail_spy_emails'].remove({})
16031
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_process_logs", "query"=>{}, "fields"=>nil}).limit(-1)
16032
+ MONGODB dummy_test['mail_spy_process_logs'].remove({})
16033
+  (0.0ms) rollback transaction
16034
+  (0.1ms) begin transaction
16035
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{}, "fields"=>nil}).limit(-1)
16036
+ MONGODB dummy_test['mail_spy_emails'].remove({})
16037
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{}, "fields"=>nil}).limit(-1)
16038
+ MONGODB dummy_test['mail_spy_emails'].remove({})
16039
+  (0.1ms) rollback transaction
16040
+  (0.0ms) begin transaction
16041
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{}, "fields"=>nil}).limit(-1)
16042
+ MONGODB dummy_test['mail_spy_emails'].remove({})
16043
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{}, "fields"=>nil}).limit(-1)
16044
+ MONGODB dummy_test['mail_spy_emails'].remove({})
16045
+  (0.1ms) rollback transaction
16046
+  (0.0ms) begin transaction
16047
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{}, "fields"=>nil}).limit(-1)
16048
+ MONGODB dummy_test['mail_spy_emails'].remove({})
16049
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{}, "fields"=>nil}).limit(-1)
16050
+ MONGODB dummy_test['mail_spy_emails'].remove({})
16051
+  (0.1ms) rollback transaction
16052
+  (0.0ms) begin transaction
16053
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{}, "fields"=>nil}).limit(-1)
16054
+ MONGODB dummy_test['mail_spy_emails'].remove({})
16055
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{}, "fields"=>nil}).limit(-1)
16056
+ MONGODB dummy_test['mail_spy_emails'].remove({})
16057
+  (0.0ms) rollback transaction
16058
+  (0.1ms) begin transaction
16059
+  (0.0ms) rollback transaction
16060
+ MONGODB [WARNING] Please note that logging negatively impacts client-side performance. You should set your logging level no lower than :info in production.
16061
+ MONGODB admin['$cmd'].find({:ismaster=>1}).limit(-1)
16062
+  (0.3ms) begin transaction
16063
+ [AWS S3 200 0.823449] get_bucket_versioning(:bucket_name=>"daviacalendar-mailspy")
16064
+
16065
+ [AWS S3 200 0.131318] head_object(:bucket_name=>"daviacalendar-mailspy",:key=>"tests/a-stream/a-helper_test.html.erb")
16066
+
16067
+ [AWS S3 200 0.124509] get_object(:bucket_name=>"daviacalendar-mailspy",:key=>"tests/a-stream/a-helper_test.html.erb")
16068
+
16069
+ [AWS S3 200 0.095148] get_bucket_versioning(:bucket_name=>"daviacalendar-mailspy")
16070
+
16071
+ [AWS S3 200 0.094755] head_object(:bucket_name=>"daviacalendar-mailspy",:key=>"tests/a-stream/a-helper_test.text.erb")
16072
+
16073
+ [AWS S3 200 0.122807] get_object(:bucket_name=>"daviacalendar-mailspy",:key=>"tests/a-stream/a-helper_test.text.erb")
16074
+
16075
+ MONGODB dummy_test['system.namespaces'].find({})
16076
+ MONGODB dummy_test['mail_spy_emails'].insert([{"headers"=>{}, "template_values"=>{}, "sent"=>false, "failed"=>false, "_id"=>BSON::ObjectId('4f339aa9ba12eb873b000001'), "to"=>"trcarden@gmail.com", "from"=>"test@test.com", "reply_to"=>"testGuy", "subject"=>"test subject", "campaign"=>"tests", "stream"=>"a-stream", "component"=>"a-helper_test", "schedule_at"=>2012-02-09 10:06:33 UTC, "email_service_provider"=>"sendgrid", "utm_source"=>"mailspy", "utm_medium"=>"email", "utm_campaign"=>"tests", "utm_term"=>"a-stream", "utm_content"=>"a-helper_test", "updated_at"=>2012-02-09 10:06:36 UTC, "created_at"=>2012-02-09 10:06:36 UTC}])
16077
+ MONGODB dummy_test['mail_spy_emails'].update({"_id"=>BSON::ObjectId('4f339aa9ba12eb873b000001')}, {"$set"=>{"headers"=>{"X-SMTPAPI"=>"{\"unique_args\": {\"eid\": \"4f339aa9ba12eb873b000001\"}}"}}})
16078
+ Rendered inline template (23.1ms)
16079
+ Rendered inline template (1.3ms)
16080
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{}, "fields"=>nil}).limit(-1)
16081
+ MONGODB dummy_test['mail_spy_emails'].remove({})
16082
+  (0.1ms) rollback transaction
16083
+  (0.0ms) begin transaction
16084
+ MONGODB dummy_test['mail_spy_emails'].insert([{"headers"=>{}, "template_values"=>{}, "sent"=>false, "failed"=>false, "_id"=>BSON::ObjectId('4f339aadba12eb873b000002'), "to"=>"trcarden@gmail.com", "from"=>"test@test.com", "reply_to"=>"testGuy", "subject"=>"test subject", "campaign"=>"tests", "stream"=>"a-stream", "component"=>"a-helper_test", "schedule_at"=>2012-02-09 10:06:37 UTC, "email_service_provider"=>"sendgrid", "utm_source"=>"mailspy", "utm_medium"=>"email", "utm_campaign"=>"tests", "utm_term"=>"a-stream", "utm_content"=>"a-helper_test", "updated_at"=>2012-02-09 10:06:37 UTC, "created_at"=>2012-02-09 10:06:37 UTC}])
16085
+ MONGODB dummy_test['mail_spy_emails'].update({"_id"=>BSON::ObjectId('4f339aadba12eb873b000002')}, {"$set"=>{"headers"=>{"X-SMTPAPI"=>"{\"unique_args\": {\"eid\": \"4f339aadba12eb873b000002\"}}"}}})
16086
+ MONGODB dummy_test['mail_spy_emails'].find({}).limit(-1).sort([[:_id, :asc]])
16087
+ Rendered inline template (1.5ms)
16088
+ Rendered inline template (1.3ms)
16089
+
16090
+ Sent mail to trcarden@gmail.com (1365ms)
16091
+ Date: Thu, 09 Feb 2012 02:06:37 -0800
16092
+ From: test@test.com
16093
+ Reply-To: testGuy
16094
+ To: trcarden@gmail.com
16095
+ Message-ID: <4f339aadc661c_873b80434f4c52247@toms-iphone-4.mail>
16096
+ Subject: test subject
16097
+ Mime-Version: 1.0
16098
+ Content-Type: multipart/alternative;
16099
+ boundary="--==_mimepart_4f339aada972a_873b80434f4c5198f";
16100
+ charset=UTF-8
16101
+ Content-Transfer-Encoding: 7bit
16102
+ X-SMTPAPI: {"unique_args": {"eid": "4f339aadba12eb873b000002"}}
16103
+
16104
+
16105
+
16106
+ ----==_mimepart_4f339aada972a_873b80434f4c5198f
16107
+ Date: Thu, 09 Feb 2012 02:06:37 -0800
16108
+ Mime-Version: 1.0
16109
+ Content-Type: text/plain;
16110
+ charset=UTF-8
16111
+ Content-Transfer-Encoding: 7bit
16112
+ Content-ID: <4f339aadb8f27_873b80434f4c52029@toms-iphone-4.mail>
16113
+
16114
+ You should be able to click on the link and have the server record the even
16115
+ and forward you to the correct place.
16116
+
16117
+ A link : <a href="http://localhost:5000/mail/t?eid=4f339aadba12eb873b000002&amp;n=1&amp;url=www.google.com">My home</a>
16118
+ ---------------------------
16119
+
16120
+ You should be able to show images in the email client and have the server
16121
+ track the open
16122
+ A Bug is in the parenthesis (<img src='http://localhost:5000/mail/b?eid=4f339aadba12eb873b000002' style='display:none' width='1' height='1' border='0' />)
16123
+
16124
+
16125
+
16126
+
16127
+ ----==_mimepart_4f339aada972a_873b80434f4c5198f
16128
+ Date: Thu, 09 Feb 2012 02:06:37 -0800
16129
+ Mime-Version: 1.0
16130
+ Content-Type: text/html;
16131
+ charset=UTF-8
16132
+ Content-Transfer-Encoding: 7bit
16133
+ Content-ID: <4f339aadc1810_873b80434f4c521c6@toms-iphone-4.mail>
16134
+
16135
+ <p>
16136
+ You should be able to click on the link and have the server record the even
16137
+ and forward you to the correct place.
16138
+
16139
+ A link : <a href="http://localhost:5000/mail/t?eid=4f339aadba12eb873b000002&amp;n=1&amp;url=www.google.com">My home</a>
16140
+ </p>
16141
+
16142
+ <br>
16143
+
16144
+ <p>
16145
+ You should be able to show images in the email client and have the server
16146
+ track the open
16147
+ A Bug is in the parenthesis (<img src='http://localhost:5000/mail/b?eid=4f339aadba12eb873b000002' style='display:none' width='1' height='1' border='0' />)
16148
+ </p>
16149
+
16150
+
16151
+
16152
+ ----==_mimepart_4f339aada972a_873b80434f4c5198f--
16153
+
16154
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{}, "fields"=>nil}).limit(-1)
16155
+ MONGODB dummy_test['mail_spy_emails'].remove({})
16156
+  (0.1ms) rollback transaction
16157
+  (0.0ms) begin transaction
16158
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{}, "fields"=>nil}).limit(-1)
16159
+ MONGODB dummy_test['mail_spy_emails'].remove({})
16160
+  (0.0ms) rollback transaction
16161
+  (0.0ms) begin transaction
16162
+ MONGODB dummy_test['system.namespaces'].find({})
16163
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_process_logs", "query"=>{}, "fields"=>nil}).limit(-1)
16164
+ MONGODB dummy_test['mail_spy_process_logs'].remove({})
16165
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{}, "fields"=>nil}).limit(-1)
16166
+ MONGODB dummy_test['mail_spy_emails'].remove({})
16167
+ MONGODB dummy_test['mail_spy_emails'].insert([{"headers"=>{}, "template_values"=>{}, "sent"=>false, "failed"=>false, "_id"=>BSON::ObjectId('4f339aafba12eb873b000003'), "to"=>"test@test.com", "from"=>"test@test.com", "reply_to"=>"testGuy", "subject"=>"test subject", "campaign"=>"tests", "stream"=>"a-stream", "component"=>"a-helper_test", "schedule_at"=>2012-02-09 10:06:39 UTC, "email_service_provider"=>"sendgrid", "utm_source"=>"mailspy", "utm_medium"=>"email", "utm_campaign"=>"tests", "utm_term"=>"a-stream", "utm_content"=>"a-helper_test", "updated_at"=>2012-02-09 10:06:39 UTC, "created_at"=>2012-02-09 10:06:39 UTC}])
16168
+ MONGODB dummy_test['mail_spy_emails'].update({"_id"=>BSON::ObjectId('4f339aafba12eb873b000003')}, {"$set"=>{"headers"=>{"X-SMTPAPI"=>"{\"unique_args\": {\"eid\": \"4f339aafba12eb873b000003\"}}"}}})
16169
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_process_logs", "query"=>{}, "fields"=>nil}).limit(-1)
16170
+ MONGODB dummy_test['mail_spy_process_logs'].remove({})
16171
+  (0.1ms) rollback transaction
16172
+  (0.0ms) begin transaction
16173
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_process_logs", "query"=>{}, "fields"=>nil}).limit(-1)
16174
+ MONGODB dummy_test['mail_spy_process_logs'].remove({})
16175
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{}, "fields"=>nil}).limit(-1)
16176
+ MONGODB dummy_test['mail_spy_emails'].remove({})
16177
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_process_logs", "query"=>{}, "fields"=>nil}).limit(-1)
16178
+ MONGODB dummy_test['mail_spy_process_logs'].remove({})
16179
+  (0.0ms) rollback transaction
16180
+  (0.0ms) begin transaction
16181
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_process_logs", "query"=>{}, "fields"=>nil}).limit(-1)
16182
+ MONGODB dummy_test['mail_spy_process_logs'].remove({})
16183
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{}, "fields"=>nil}).limit(-1)
16184
+ MONGODB dummy_test['mail_spy_emails'].remove({})
16185
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_process_logs", "query"=>{}, "fields"=>nil}).limit(-1)
16186
+ MONGODB dummy_test['mail_spy_process_logs'].remove({})
16187
+  (0.1ms) rollback transaction
16188
+  (0.0ms) begin transaction
16189
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_process_logs", "query"=>{}, "fields"=>nil}).limit(-1)
16190
+ MONGODB dummy_test['mail_spy_process_logs'].remove({})
16191
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{}, "fields"=>nil}).limit(-1)
16192
+ MONGODB dummy_test['mail_spy_emails'].remove({})
16193
+ [AWS S3 200 0.091908] get_bucket_versioning(:bucket_name=>"daviacalendar-mailspy")
16194
+
16195
+ [AWS S3 404 0.095029] head_object(:bucket_name=>"daviacalendar-mailspy",:key=>"NO SUCH CAMPAIGN/NO SUCH STREAM/NO SUCH COMPONENT.html.erb") AWS::S3::Errors::NoSuchKey: No Such Key
16196
+
16197
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_process_logs", "query"=>{}, "fields"=>nil}).limit(-1)
16198
+ MONGODB dummy_test['mail_spy_process_logs'].remove({})
16199
+  (0.1ms) rollback transaction
16200
+  (0.0ms) begin transaction
16201
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_process_logs", "query"=>{}, "fields"=>nil}).limit(-1)
16202
+ MONGODB dummy_test['mail_spy_process_logs'].remove({})
16203
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{}, "fields"=>nil}).limit(-1)
16204
+ MONGODB dummy_test['mail_spy_emails'].remove({})
16205
+ MONGODB dummy_test['mail_spy_emails'].insert([{"headers"=>{}, "template_values"=>{}, "sent"=>false, "failed"=>false, "_id"=>BSON::ObjectId('4f339aafba12eb873b000005'), "to"=>"trcarden@gmail.com", "from"=>"test@test.com", "reply_to"=>"testGuy", "subject"=>"test subject", "campaign"=>"tests", "stream"=>"a-stream", "component"=>"a-helper_test", "schedule_at"=>2012-02-09 10:06:39 UTC, "email_service_provider"=>"sendgrid", "utm_source"=>"mailspy", "utm_medium"=>"email", "utm_campaign"=>"tests", "utm_term"=>"a-stream", "utm_content"=>"a-helper_test", "updated_at"=>2012-02-09 10:06:39 UTC, "created_at"=>2012-02-09 10:06:39 UTC}])
16206
+ MONGODB dummy_test['mail_spy_emails'].update({"_id"=>BSON::ObjectId('4f339aafba12eb873b000005')}, {"$set"=>{"headers"=>{"X-SMTPAPI"=>"{\"unique_args\": {\"eid\": \"4f339aafba12eb873b000005\"}}"}}})
16207
+ MONGODB dummy_test['mail_spy_process_logs'].find({:running=>true}).limit(-1).sort([[:_id, :asc]])
16208
+ MONGODB dummy_test['mail_spy_process_logs'].insert([{"success"=>false, "running"=>true, "_id"=>BSON::ObjectId('4f339aafba12eb873b000006'), "start"=>2012-02-09 10:06:39 UTC, "updated_at"=>2012-02-09 10:06:39 UTC, "created_at"=>2012-02-09 10:06:39 UTC}])
16209
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{:schedule_at=>{"$lte"=>2012-02-09 10:06:39 UTC}, :sent=>false, :failed=>false}, "fields"=>nil}).limit(-1)
16210
+ MONGODB dummy_test['mail_spy_emails'].find({:schedule_at=>{"$lte"=>2012-02-09 10:06:39 UTC}, :sent=>false, :failed=>false}).limit(100).sort([[:_id, :asc]])
16211
+ Rendered inline template (1.8ms)
16212
+ Rendered inline template (1.3ms)
16213
+
16214
+ Sent mail to trcarden@gmail.com (1207ms)
16215
+ Date: Thu, 09 Feb 2012 02:06:39 -0800
16216
+ From: test@test.com
16217
+ Reply-To: testGuy
16218
+ To: trcarden@gmail.com
16219
+ Message-ID: <4f339aaf5ff2b_873b844c03a452619@toms-iphone-4.mail>
16220
+ Subject: test subject
16221
+ Mime-Version: 1.0
16222
+ Content-Type: multipart/alternative;
16223
+ boundary="--==_mimepart_4f339aaf5b54c_873b844c03a45237";
16224
+ charset=UTF-8
16225
+ Content-Transfer-Encoding: 7bit
16226
+ X-SMTPAPI: {"unique_args": {"eid": "4f339aafba12eb873b000005"}}
16227
+
16228
+
16229
+
16230
+ ----==_mimepart_4f339aaf5b54c_873b844c03a45237
16231
+ Date: Thu, 09 Feb 2012 02:06:39 -0800
16232
+ Mime-Version: 1.0
16233
+ Content-Type: text/plain;
16234
+ charset=UTF-8
16235
+ Content-Transfer-Encoding: 7bit
16236
+ Content-ID: <4f339aaf5e38e_873b844c03a4524d4@toms-iphone-4.mail>
16237
+
16238
+ You should be able to click on the link and have the server record the even
16239
+ and forward you to the correct place.
16240
+
16241
+ A link : <a href="http://localhost:5000/mail/t?eid=4f339aafba12eb873b000005&amp;n=1&amp;url=www.google.com">My home</a>
16242
+ ---------------------------
16243
+
16244
+ You should be able to show images in the email client and have the server
16245
+ track the open
16246
+ A Bug is in the parenthesis (<img src='http://localhost:5000/mail/b?eid=4f339aafba12eb873b000005' style='display:none' width='1' height='1' border='0' />)
16247
+
16248
+
16249
+
16250
+
16251
+ ----==_mimepart_4f339aaf5b54c_873b844c03a45237
16252
+ Date: Thu, 09 Feb 2012 02:06:39 -0800
16253
+ Mime-Version: 1.0
16254
+ Content-Type: text/html;
16255
+ charset=UTF-8
16256
+ Content-Transfer-Encoding: 7bit
16257
+ Content-ID: <4f339aaf5f3e8_873b844c03a452524@toms-iphone-4.mail>
16258
+
16259
+ <p>
16260
+ You should be able to click on the link and have the server record the even
16261
+ and forward you to the correct place.
16262
+
16263
+ A link : <a href="http://localhost:5000/mail/t?eid=4f339aafba12eb873b000005&amp;n=1&amp;url=www.google.com">My home</a>
16264
+ </p>
16265
+
16266
+ <br>
16267
+
16268
+ <p>
16269
+ You should be able to show images in the email client and have the server
16270
+ track the open
16271
+ A Bug is in the parenthesis (<img src='http://localhost:5000/mail/b?eid=4f339aafba12eb873b000005' style='display:none' width='1' height='1' border='0' />)
16272
+ </p>
16273
+
16274
+
16275
+
16276
+ ----==_mimepart_4f339aaf5b54c_873b844c03a45237--
16277
+
16278
+ MONGODB dummy_test['mail_spy_emails'].update({"_id"=>BSON::ObjectId('4f339aafba12eb873b000005')}, {"$set"=>{"sent"=>true, "updated_at"=>2012-02-09 10:06:40 UTC}})
16279
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{:schedule_at=>{"$lte"=>2012-02-09 10:06:39 UTC}, :sent=>false, :failed=>false}, "fields"=>nil}).limit(-1)
16280
+ MONGODB dummy_test['mail_spy_process_logs'].update({"_id"=>BSON::ObjectId('4f339aafba12eb873b000006')}, {"$set"=>{"end"=>2012-02-09 10:06:40 UTC, "seconds_elapsed"=>1, "running"=>false, "success"=>true, "updated_at"=>2012-02-09 10:06:40 UTC}})
16281
+ MONGODB dummy_test['mail_spy_process_logs'].find({}).limit(-1).sort([[:_id, :asc]])
16282
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_process_logs", "query"=>{}, "fields"=>nil}).limit(-1)
16283
+ MONGODB dummy_test['mail_spy_process_logs'].remove({})
16284
+  (0.1ms) rollback transaction
16285
+  (0.0ms) begin transaction
16286
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_process_logs", "query"=>{}, "fields"=>nil}).limit(-1)
16287
+ MONGODB dummy_test['mail_spy_process_logs'].remove({})
16288
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{}, "fields"=>nil}).limit(-1)
16289
+ MONGODB dummy_test['mail_spy_emails'].remove({})
16290
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_process_logs", "query"=>{}, "fields"=>nil}).limit(-1)
16291
+ MONGODB dummy_test['mail_spy_process_logs'].remove({})
16292
+  (0.0ms) rollback transaction
16293
+  (0.1ms) begin transaction
16294
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{}, "fields"=>nil}).limit(-1)
16295
+ MONGODB dummy_test['mail_spy_emails'].remove({})
16296
+ MONGODB dummy_test['mail_spy_emails'].insert([{"headers"=>{}, "template_values"=>{}, "sent"=>false, "failed"=>false, "_id"=>BSON::ObjectId('4f339ab0ba12eb873b000007'), "to"=>"trcarden@gmail.com", "from"=>"test@test.com", "reply_to"=>"testGuy", "subject"=>"test subject", "campaign"=>"tests", "stream"=>"a-stream", "component"=>"a-helper_test", "schedule_at"=>2012-02-09 10:06:40 UTC, "email_service_provider"=>"sendgrid", "utm_source"=>"mailspy", "utm_medium"=>"email", "utm_campaign"=>"tests", "utm_term"=>"a-stream", "utm_content"=>"a-helper_test", "updated_at"=>2012-02-09 10:06:40 UTC, "created_at"=>2012-02-09 10:06:40 UTC}])
16297
+ MONGODB dummy_test['mail_spy_emails'].update({"_id"=>BSON::ObjectId('4f339ab0ba12eb873b000007')}, {"$set"=>{"headers"=>{"X-SMTPAPI"=>"{\"unique_args\": {\"eid\": \"4f339ab0ba12eb873b000007\"}}"}}})
16298
+ MONGODB dummy_test['mail_spy_emails'].find({}).limit(-1).sort([[:_id, :asc]])
16299
+ Processing by MailSpy::TrackingController#action as HTML
16300
+ Parameters: {"eid"=>"4f339ab0ba12eb873b000007", "action_type"=>"Conversion", "count"=>"3"}
16301
+ MONGODB dummy_test['mail_spy_emails'].find({:_id=>BSON::ObjectId('4f339ab0ba12eb873b000007')}).limit(-1).sort([[:_id, :asc]])
16302
+ MONGODB dummy_test['mail_spy_emails'].update({"_id"=>BSON::ObjectId('4f339ab0ba12eb873b000007')}, {"$push"=>{"actions"=>{"count"=>3, "_id"=>BSON::ObjectId('4f339ab0ba12eb873b000008'), "action_type"=>"Conversion", "updated_at"=>2012-02-09 10:06:40 UTC, "created_at"=>2012-02-09 10:06:40 UTC}}})
16303
+ Completed 200 OK in 5ms (ActiveRecord: 0.0ms)
16304
+ MONGODB dummy_test['mail_spy_emails'].find({:_id=>BSON::ObjectId('4f339ab0ba12eb873b000007')}).limit(-1)
16305
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{}, "fields"=>nil}).limit(-1)
16306
+ MONGODB dummy_test['mail_spy_emails'].remove({})
16307
+  (0.1ms) rollback transaction
16308
+  (0.0ms) begin transaction
16309
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{}, "fields"=>nil}).limit(-1)
16310
+ MONGODB dummy_test['mail_spy_emails'].remove({})
16311
+ MONGODB dummy_test['mail_spy_emails'].insert([{"headers"=>{}, "template_values"=>{}, "sent"=>false, "failed"=>false, "_id"=>BSON::ObjectId('4f339ab0ba12eb873b000009'), "to"=>"trcarden@gmail.com", "from"=>"test@test.com", "reply_to"=>"testGuy", "subject"=>"test subject", "campaign"=>"tests", "stream"=>"a-stream", "component"=>"a-helper_test", "schedule_at"=>2012-02-09 10:06:40 UTC, "email_service_provider"=>"sendgrid", "utm_source"=>"mailspy", "utm_medium"=>"email", "utm_campaign"=>"tests", "utm_term"=>"a-stream", "utm_content"=>"a-helper_test", "updated_at"=>2012-02-09 10:06:40 UTC, "created_at"=>2012-02-09 10:06:40 UTC}])
16312
+ MONGODB dummy_test['mail_spy_emails'].update({"_id"=>BSON::ObjectId('4f339ab0ba12eb873b000009')}, {"$set"=>{"headers"=>{"X-SMTPAPI"=>"{\"unique_args\": {\"eid\": \"4f339ab0ba12eb873b000009\"}}"}}})
16313
+ MONGODB dummy_test['mail_spy_emails'].find({}).limit(-1).sort([[:_id, :asc]])
16314
+ Processing by MailSpy::TrackingController#bug as HTML
16315
+ Parameters: {"eid"=>"4f339ab0ba12eb873b000009"}
16316
+ MONGODB dummy_test['mail_spy_emails'].find({:_id=>BSON::ObjectId('4f339ab0ba12eb873b000009')}).limit(-1).sort([[:_id, :asc]])
16317
+ MONGODB dummy_test['mail_spy_emails'].update({"_id"=>BSON::ObjectId('4f339ab0ba12eb873b000009')}, {"$push"=>{"actions"=>{"count"=>1, "_id"=>BSON::ObjectId('4f339ab0ba12eb873b00000a'), "action_type"=>"open", "updated_at"=>2012-02-09 10:06:40 UTC, "created_at"=>2012-02-09 10:06:40 UTC}}})
16318
+ Completed 200 OK in 3ms (ActiveRecord: 0.0ms)
16319
+ MONGODB dummy_test['mail_spy_emails'].find({:_id=>BSON::ObjectId('4f339ab0ba12eb873b000009')}).limit(-1)
16320
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{}, "fields"=>nil}).limit(-1)
16321
+ MONGODB dummy_test['mail_spy_emails'].remove({})
16322
+  (0.1ms) rollback transaction
16323
+  (0.0ms) begin transaction
16324
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{}, "fields"=>nil}).limit(-1)
16325
+ MONGODB dummy_test['mail_spy_emails'].remove({})
16326
+ MONGODB dummy_test['mail_spy_emails'].insert([{"headers"=>{}, "template_values"=>{}, "sent"=>false, "failed"=>false, "_id"=>BSON::ObjectId('4f339ab0ba12eb873b00000b'), "to"=>"trcarden@gmail.com", "from"=>"test@test.com", "reply_to"=>"testGuy", "subject"=>"test subject", "campaign"=>"tests", "stream"=>"a-stream", "component"=>"a-helper_test", "schedule_at"=>2012-02-09 10:06:40 UTC, "email_service_provider"=>"sendgrid", "utm_source"=>"mailspy", "utm_medium"=>"email", "utm_campaign"=>"tests", "utm_term"=>"a-stream", "utm_content"=>"a-helper_test", "updated_at"=>2012-02-09 10:06:40 UTC, "created_at"=>2012-02-09 10:06:40 UTC}])
16327
+ MONGODB dummy_test['mail_spy_emails'].update({"_id"=>BSON::ObjectId('4f339ab0ba12eb873b00000b')}, {"$set"=>{"headers"=>{"X-SMTPAPI"=>"{\"unique_args\": {\"eid\": \"4f339ab0ba12eb873b00000b\"}}"}}})
16328
+ MONGODB dummy_test['mail_spy_emails'].find({}).limit(-1).sort([[:_id, :asc]])
16329
+ Processing by MailSpy::TrackingController#link as HTML
16330
+ Parameters: {"eid"=>"4f339ab0ba12eb873b00000b", "url"=>"http://google.com", "n"=>"0"}
16331
+ MONGODB dummy_test['mail_spy_emails'].find({:_id=>BSON::ObjectId('4f339ab0ba12eb873b00000b')}).limit(-1).sort([[:_id, :asc]])
16332
+ MONGODB dummy_test['mail_spy_emails'].update({"_id"=>BSON::ObjectId('4f339ab0ba12eb873b00000b')}, {"$push"=>{"actions"=>{"count"=>1, "_id"=>BSON::ObjectId('4f339ab0ba12eb873b00000c'), "action_type"=>"click", "details"=>{:url=>"http://google.com", :link_number=>"0"}, "updated_at"=>2012-02-09 10:06:40 UTC, "created_at"=>2012-02-09 10:06:40 UTC}}})
16333
+ Redirected to http://google.com?utm_campaign=tests&utm_content=a-helper_test&utm_medium=email&utm_source=mailspy&utm_term=a-stream
16334
+ Completed 302 Found in 3ms (ActiveRecord: 0.0ms)
16335
+ MONGODB dummy_test['mail_spy_emails'].find({}).limit(-1).sort([[:_id, :asc]])
16336
+ MONGODB dummy_test['mail_spy_emails'].find({:_id=>BSON::ObjectId('4f339ab0ba12eb873b00000b')}).limit(-1)
16337
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{}, "fields"=>nil}).limit(-1)
16338
+ MONGODB dummy_test['mail_spy_emails'].remove({})
16339
+  (0.1ms) rollback transaction
16340
+  (0.0ms) begin transaction
16341
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{}, "fields"=>nil}).limit(-1)
16342
+ MONGODB dummy_test['mail_spy_emails'].remove({})
16343
+ MONGODB dummy_test['mail_spy_emails'].insert([{"headers"=>{}, "template_values"=>{}, "sent"=>false, "failed"=>false, "_id"=>BSON::ObjectId('4f339ab0ba12eb873b00000d'), "to"=>"trcarden@gmail.com", "from"=>"test@test.com", "reply_to"=>"testGuy", "subject"=>"test subject", "campaign"=>"tests", "stream"=>"a-stream", "component"=>"a-helper_test", "schedule_at"=>2012-02-09 10:06:40 UTC, "email_service_provider"=>"sendgrid", "utm_source"=>"mailspy", "utm_medium"=>"email", "utm_campaign"=>"tests", "utm_term"=>"a-stream", "utm_content"=>"a-helper_test", "updated_at"=>2012-02-09 10:06:40 UTC, "created_at"=>2012-02-09 10:06:40 UTC}])
16344
+ MONGODB dummy_test['mail_spy_emails'].update({"_id"=>BSON::ObjectId('4f339ab0ba12eb873b00000d')}, {"$set"=>{"headers"=>{"X-SMTPAPI"=>"{\"unique_args\": {\"eid\": \"4f339ab0ba12eb873b00000d\"}}"}}})
16345
+ MONGODB dummy_test['mail_spy_emails'].find({}).limit(-1).sort([[:_id, :asc]])
16346
+ MONGODB dummy_test['$cmd'].find({"count"=>"mail_spy_emails", "query"=>{}, "fields"=>nil}).limit(-1)
16347
+ MONGODB dummy_test['mail_spy_emails'].remove({})
16348
+  (0.0ms) rollback transaction
16349
+  (0.1ms) begin transaction
16350
+  (0.0ms) rollback transaction
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: mail_spy
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.18
5
+ version: 0.1.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Timothy Cardenas
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-02-08 00:00:00 Z
13
+ date: 2012-02-09 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails