mail_spy 0.0.2 → 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/README.rdoc +86 -24
- data/app/assets/images/mail_spy/background_tile.gif +0 -0
- data/app/assets/images/mail_spy/mailspy_sprite.png +0 -0
- data/app/assets/images/mail_spy/spy.ico +0 -0
- data/app/assets/javascripts/mail_spy/lib/backbone.js +1256 -0
- data/app/assets/javascripts/mail_spy/lib/underscore.js +999 -0
- data/app/assets/javascripts/mail_spy/reports.js +2 -0
- data/app/assets/javascripts/mail_spy/sendgrid.js +2 -0
- data/app/assets/stylesheets/mail_spy/application.css +62 -1
- data/app/assets/stylesheets/mail_spy/reports.css.scss +128 -0
- data/app/assets/stylesheets/mail_spy/sendgrid.css +4 -0
- data/app/controllers/mail_spy/reports_controller.rb +29 -0
- data/app/controllers/mail_spy/sendgrid_controller.rb +26 -0
- data/app/controllers/mail_spy/tracking_controller.rb +19 -11
- data/app/helpers/mail_spy/email_helper.rb +21 -3
- data/app/helpers/mail_spy/reports_helper.rb +4 -0
- data/app/helpers/mail_spy/sendgrid_helper.rb +4 -0
- data/app/mailers/mail_spy/core_mailer.rb +15 -18
- data/app/models/mail_spy/email.rb +127 -19
- data/app/models/mail_spy/process_log.rb +25 -0
- data/app/views/layouts/mail_spy/application.html.erb +3 -0
- data/app/views/mail_spy/reports/campaigns.html.erb +138 -0
- data/config/routes.rb +6 -0
- data/lib/generators/mail_spy/templates/mail_spy.rb +25 -1
- data/lib/mail_spy/manager.rb +100 -54
- data/lib/mail_spy/sendgrid/smtp_api_header.rb +68 -0
- data/lib/mail_spy/version.rb +1 -1
- data/lib/mail_spy.rb +39 -5
- data/test/dummy/app/views/email_templates/helper_test.html.erb +15 -0
- data/test/dummy/app/views/email_templates/helper_test.text.erb +11 -0
- data/test/dummy/config/environments/development.rb +1 -1
- data/test/dummy/config/environments/production.rb +5 -1
- data/test/dummy/config/environments/test.rb +4 -1
- data/test/dummy/config/initializers/mail_spy.rb +42 -0
- data/test/dummy/config/routes.rb +1 -2
- data/test/dummy/db/schema.rb +16 -0
- data/test/dummy/db/seeds.rb +16 -13
- data/test/dummy/lib/tasks/emails.rake +8 -0
- data/test/dummy/log/development.log +782 -0
- data/test/dummy/log/test.log +9952 -0
- data/test/fixtures/mail_spy/process_logs.yml +15 -0
- data/test/functional/mail_spy/core_mailer_test.rb +16 -9
- data/test/functional/mail_spy/reports_controller_test.rb +9 -0
- data/test/functional/mail_spy/sendgrid_controller_test.rb +9 -0
- data/test/functional/mail_spy/tracking_controller_test.rb +16 -11
- data/test/test_email_credentials.yml +2 -2
- data/test/test_email_credentials.yml.sample +0 -8
- data/test/test_helper.rb +15 -41
- data/test/unit/helpers/mail_spy/reports_helper_test.rb +6 -0
- data/test/unit/helpers/mail_spy/sendgrid_helper_test.rb +6 -0
- data/test/unit/mail_spy/manager_test.rb +101 -122
- data/test/unit/mail_spy/{email_template_test.rb → process_log_test.rb} +1 -1
- metadata +122 -34
- data/app/models/mail_spy/email_template.rb +0 -17
- data/test/fixtures/mail_spy/email_templates.yml +0 -9
- /data/lib/generators/mail_spy/{initialize_generator.rb → initializer_generator.rb} +0 -0
data/README.rdoc
CHANGED
|
@@ -12,57 +12,119 @@ Add gem "mailspy" to your Gemfile
|
|
|
12
12
|
gem "mailspy"
|
|
13
13
|
|
|
14
14
|
|
|
15
|
+
If you haven't already create a mongoid.yml file for the mongodb connection
|
|
16
|
+
rails generate mongoid:config
|
|
17
|
+
|
|
18
|
+
If you are going to be sending on one machine make sure to scale up the pool
|
|
19
|
+
from the default of 1 to 10+ to get good performance. Timeouts are also a good idea
|
|
20
|
+
|
|
15
21
|
Create the mongoid configuration for the mongo db
|
|
16
22
|
|
|
17
|
-
rails g
|
|
23
|
+
rails g mail_spy:initializer
|
|
18
24
|
|
|
19
|
-
Fill out the generated
|
|
25
|
+
Fill out the generated mailspy.rb with your esp settings (file has example)
|
|
26
|
+
and AWS settings
|
|
20
27
|
|
|
21
28
|
Then mount the engine in the routes.rb file
|
|
22
29
|
Rails.application.routes.draw do
|
|
23
|
-
mount MailSpy::Engine => "/
|
|
30
|
+
mount MailSpy::Engine => "/mail"
|
|
24
31
|
end
|
|
25
32
|
|
|
33
|
+
Finally run rake db:mongoid:create_indexes to get performant sends
|
|
34
|
+
|
|
26
35
|
== Usage
|
|
27
36
|
|
|
28
|
-
|
|
37
|
+
Mailspy is centered around email templates and instances of those templates
|
|
38
|
+
(aka emails).
|
|
29
39
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
include Virality
|
|
33
|
-
before_filter :track_virality
|
|
40
|
+
To create a template:
|
|
41
|
+
add a template to your s3 directory, campaign/stream/component.(text|html).erb
|
|
34
42
|
|
|
35
|
-
end
|
|
36
43
|
|
|
37
|
-
|
|
38
|
-
|
|
44
|
+
To create a instance:
|
|
45
|
+
|
|
46
|
+
MailSpy.create_email(options)
|
|
47
|
+
|
|
48
|
+
required options include:
|
|
49
|
+
|
|
50
|
+
* :campaign :top level grouping
|
|
51
|
+
* :stream : mid level grouping
|
|
52
|
+
* :component : bottom level grouping
|
|
53
|
+
* :schedule_at
|
|
54
|
+
* :subject
|
|
55
|
+
* :template_values
|
|
56
|
+
* :from
|
|
57
|
+
* :reply_to
|
|
58
|
+
* one of [:to, :cc, :bcc]
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
== Sendgrid
|
|
62
|
+
|
|
63
|
+
MailSpy has bindings baked in for sendgrid event notification.
|
|
64
|
+
|
|
65
|
+
To enable simply configure sendgrid to send post notifications (no batch support yet)
|
|
66
|
+
to YOUR_HOST/mount_path/sendgrid/notification
|
|
67
|
+
|
|
68
|
+
The mount path is usually 'mail' but is configurable in your routes file
|
|
39
69
|
|
|
40
|
-
|
|
41
|
-
and using the message_for_conceit to populate your channel messages
|
|
70
|
+
finally add
|
|
42
71
|
|
|
72
|
+
esp.options = {
|
|
73
|
+
:enable_sendgrid_event_tracking => true
|
|
74
|
+
}
|
|
43
75
|
|
|
76
|
+
to your initializers/mail_spy.rb file
|
|
44
77
|
|
|
45
|
-
|
|
78
|
+
This will automatically add in the sendgrid smtp api headers and record all
|
|
79
|
+
events you have setup using the sendgrid admin interface.
|
|
46
80
|
|
|
47
|
-
If you
|
|
48
|
-
|
|
81
|
+
Reminder: If you are using open and click tracking using MailSpy adding them
|
|
82
|
+
to sendgrid will be redundant and harmful.
|
|
49
83
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
84
|
+
== Google Analytics
|
|
85
|
+
|
|
86
|
+
MailSpy has automatic bindings for google analytics.
|
|
87
|
+
|
|
88
|
+
MailSpy requires that all emails form into the campaign, stream, component
|
|
89
|
+
structure which lends itself nicely to a direct mapping in google analytics.
|
|
90
|
+
|
|
91
|
+
utm_source => MailSpy - #{tracker_host}
|
|
92
|
+
utm_medium => email
|
|
93
|
+
utm_campaign => campaign
|
|
94
|
+
utm_term => stream
|
|
95
|
+
utm_content => component
|
|
96
|
+
|
|
97
|
+
To enable automatic bindings with all links generated by 'track_link' and
|
|
98
|
+
helper simply add
|
|
99
|
+
|
|
100
|
+
esp.options = {
|
|
101
|
+
:enable_auto_google_analytics => true
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
to your initializers/mail_spy.rb file
|
|
105
|
+
|
|
106
|
+
if you prefer to assign GA settings manually you can do that directly as
|
|
107
|
+
a option to MailSpy.create_email
|
|
108
|
+
|
|
109
|
+
the keys are:
|
|
110
|
+
|
|
111
|
+
* utm_source
|
|
112
|
+
* utm_medium
|
|
113
|
+
* utm_campaign
|
|
114
|
+
* utm_term
|
|
115
|
+
* utm_content
|
|
116
|
+
|
|
117
|
+
Again only links built with track_link will benefit from the GA tokens
|
|
55
118
|
|
|
56
119
|
== Testing
|
|
57
120
|
|
|
58
|
-
You will need to add your own
|
|
121
|
+
You will need to add your own mongoid.yml to the dummy app, rake db:create, and
|
|
59
122
|
rake db:migrate and rake db:test:prepare to get the dummy app setup.
|
|
60
123
|
|
|
61
124
|
Then you can simply run rake from the plugins test directory
|
|
62
125
|
|
|
126
|
+
TODO explain the test_email_credentials.yml file in /test
|
|
63
127
|
|
|
64
128
|
|
|
65
129
|
== License
|
|
66
|
-
This project is property of Ooga Labs and not open source software
|
|
67
|
-
|
|
68
130
|
This project rocks and uses MIT-LICENSE.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|