mail_spy 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
@@ -14,7 +14,22 @@ module MailSpy
|
|
14
14
|
}
|
15
15
|
)
|
16
16
|
|
17
|
-
|
17
|
+
|
18
|
+
# Add in the GA tokens if present
|
19
|
+
|
20
|
+
ga_hash = {}
|
21
|
+
ga_hash[:utm_source] = email.utm_source if email.utm_source.present?
|
22
|
+
ga_hash[:utm_medium] = email.utm_medium if email.utm_medium.present?
|
23
|
+
ga_hash[:utm_campaign] = email.utm_campaign if email.utm_campaign.present?
|
24
|
+
ga_hash[:utm_term] = email.utm_term if email.utm_term.present?
|
25
|
+
ga_hash[:utm_content] = email.utm_content if email.utm_content.present?
|
26
|
+
|
27
|
+
#TODO this is not fool proof, it breaks on bad urls (like missing http://)
|
28
|
+
#TODO this also breaks when a param is already present it isn;t smart
|
29
|
+
uri = URI.parse(params[:url])
|
30
|
+
uri.query = [uri.query, ga_hash.to_param].compact.join('&')
|
31
|
+
|
32
|
+
redirect_to uri.to_s
|
18
33
|
end
|
19
34
|
|
20
35
|
def bug
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
1
3
|
module MailSpy
|
2
4
|
module EmailHelper
|
3
5
|
|
@@ -21,6 +23,7 @@ module MailSpy
|
|
21
23
|
tag_options = tag_options(html_options)
|
22
24
|
|
23
25
|
# Inject our tracking url, and pass in the redirect_url
|
26
|
+
|
24
27
|
hash = {
|
25
28
|
:controller => "mail_spy/tracking",
|
26
29
|
:action => :link,
|
@@ -31,16 +34,8 @@ module MailSpy
|
|
31
34
|
:eid => @_email.id
|
32
35
|
}
|
33
36
|
|
34
|
-
# Add in the GA tokens if present
|
35
|
-
hash[:utm_source] = @_email.utm_source if @_email.utm_source.present?
|
36
|
-
hash[:utm_medium] = @_email.utm_medium if @_email.utm_medium.present?
|
37
|
-
hash[:utm_campaign] = @_email.utm_campaign if @_email.utm_campaign.present?
|
38
|
-
hash[:utm_term] = @_email.utm_term if @_email.utm_term.present?
|
39
|
-
hash[:utm_content] = @_email.utm_content if @_email.utm_content.present?
|
40
|
-
|
41
37
|
url = url_for(hash)
|
42
38
|
|
43
|
-
|
44
39
|
href_attr = "href=\"#{ERB::Util.html_escape(url)}\"" unless href
|
45
40
|
"<a #{href_attr}#{tag_options}>#{ERB::Util.html_escape(name || url)}</a>".html_safe
|
46
41
|
end
|
data/config/routes.rb
CHANGED
data/lib/mail_spy/manager.rb
CHANGED
@@ -20,7 +20,8 @@ module MailSpy
|
|
20
20
|
[:campaign, :stream, :component].each { |key| raise "##{key} can't be blank" if options[key].blank? }
|
21
21
|
|
22
22
|
# Make sure we have someone to send to
|
23
|
-
|
23
|
+
# TODO need to test setting the options but filling with nil
|
24
|
+
has_sender = to_options.select { |option| options[option].present? }.present?
|
24
25
|
raise "Email instance has no sender (to,cc,bcc were all blank)" unless has_sender
|
25
26
|
|
26
27
|
# Make sure that all options passed map to a accessor so we don't errantly
|
@@ -96,8 +97,8 @@ module MailSpy
|
|
96
97
|
sent += 1
|
97
98
|
rescue Exception => e
|
98
99
|
email.failed = true
|
99
|
-
email.error_message = e.message
|
100
|
-
email.error_backtrace = e.backtrace
|
100
|
+
email.error_message = e.try(:message)
|
101
|
+
email.error_backtrace = e.try(:backtrace)
|
101
102
|
email.save!
|
102
103
|
end
|
103
104
|
end
|
data/lib/mail_spy/version.rb
CHANGED
@@ -222,3 +222,49 @@ MONGODB [WARNING] Please note that logging negatively impacts client-side perfor
|
|
222
222
|
MONGODB admin['$cmd'].find({:ismaster=>1}).limit(-1)
|
223
223
|
MONGODB [WARNING] Please note that logging negatively impacts client-side performance. You should set your logging level no lower than :info in production.
|
224
224
|
MONGODB admin['$cmd'].find({:ismaster=>1}).limit(-1)
|
225
|
+
MONGODB [WARNING] Please note that logging negatively impacts client-side performance. You should set your logging level no lower than :info in production.
|
226
|
+
MONGODB admin['$cmd'].find({:ismaster=>1}).limit(-1)
|
227
|
+
MONGODB [WARNING] Please note that logging negatively impacts client-side performance. You should set your logging level no lower than :info in production.
|
228
|
+
MONGODB admin['$cmd'].find({:ismaster=>1}).limit(-1)
|
229
|
+
|
230
|
+
|
231
|
+
Started GET "/mail/test?url=www.google.com" for 127.0.0.1 at 2012-02-02 08:16:52 -0800
|
232
|
+
Processing by MailSpy::TrackingController#test as HTML
|
233
|
+
Parameters: {"url"=>"www.google.com"}
|
234
|
+
Redirected to http://localhost:3000www.google.com
|
235
|
+
Completed 302 Found in 1ms (ActiveRecord: 0.0ms)
|
236
|
+
|
237
|
+
|
238
|
+
Started GET "/mail/test?url=http://www.google.com" for 127.0.0.1 at 2012-02-02 08:17:18 -0800
|
239
|
+
Processing by MailSpy::TrackingController#test as HTML
|
240
|
+
Parameters: {"url"=>"http://www.google.com"}
|
241
|
+
Redirected to http://www.google.com
|
242
|
+
Completed 302 Found in 0ms (ActiveRecord: 0.0ms)
|
243
|
+
|
244
|
+
|
245
|
+
Started GET "/mail/test?url=http://www.google.com" for 127.0.0.1 at 2012-02-02 08:32:03 -0800
|
246
|
+
Processing by MailSpy::TrackingController#test as HTML
|
247
|
+
Parameters: {"url"=>"http://www.google.com"}
|
248
|
+
Redirected to http://www.google.com?id=1&wee=3
|
249
|
+
Completed 302 Found in 1ms (ActiveRecord: 0.0ms)
|
250
|
+
|
251
|
+
|
252
|
+
Started GET "/mail/test?url=http://www.google.com?dft=1" for 127.0.0.1 at 2012-02-02 08:32:33 -0800
|
253
|
+
Processing by MailSpy::TrackingController#test as HTML
|
254
|
+
Parameters: {"url"=>"http://www.google.com?dft=1"}
|
255
|
+
Redirected to http://www.google.com?dft=1&id=1&wee=3
|
256
|
+
Completed 302 Found in 1ms (ActiveRecord: 0.0ms)
|
257
|
+
|
258
|
+
|
259
|
+
Started GET "/mail/test?url=www.google.com" for 127.0.0.1 at 2012-02-02 08:32:59 -0800
|
260
|
+
Processing by MailSpy::TrackingController#test as HTML
|
261
|
+
Parameters: {"url"=>"www.google.com"}
|
262
|
+
Redirected to http://localhost:3000www.google.com?id=1&wee=3
|
263
|
+
Completed 302 Found in 1ms (ActiveRecord: 0.0ms)
|
264
|
+
|
265
|
+
|
266
|
+
Started GET "/mail/test?url=www.google.com" for 127.0.0.1 at 2012-02-02 08:32:59 -0800
|
267
|
+
Processing by MailSpy::TrackingController#test as HTML
|
268
|
+
Parameters: {"url"=>"www.google.com"}
|
269
|
+
Redirected to http://localhost:3000www.google.com?id=1&wee=3
|
270
|
+
Completed 302 Found in 1ms (ActiveRecord: 0.0ms)
|