mail_engine 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/app/controllers/mail_engine/application_controller.rb +6 -4
- data/app/controllers/mail_engine/dashboard_controller.rb +1 -0
- data/app/controllers/mail_engine/mail_logs_controller.rb +1 -0
- data/app/controllers/mail_engine/mail_schedules_controller.rb +3 -3
- data/app/controllers/mail_engine/mail_template_files_controller.rb +6 -6
- data/app/controllers/mail_engine/mail_templates_controller.rb +4 -10
- data/app/controllers/mail_engine/reports_controller.rb +0 -1
- data/app/helpers/mail_engine/mail_engine_helper.rb +1 -0
- data/app/mailers/mail_engine/mail_dispatcher.rb +3 -5
- data/lib/mail_engine/action_mailer_patch.rb +1 -2
- data/lib/mail_engine/generators/templates/mail_engine_config.yml +6 -1
- data/mail_engine.gemspec +2 -2
- data/test/dummy/app/mailers/user_mailer.rb +2 -3
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.9
|
@@ -1,14 +1,16 @@
|
|
1
1
|
class MailEngine::ApplicationController < ApplicationController
|
2
|
+
include MailEngine
|
3
|
+
helper MailEngine::MailEngineHelper
|
4
|
+
|
2
5
|
layout 'mail_engine/mail_engine'
|
3
6
|
|
4
|
-
# set the access check method.
|
7
|
+
# set the access check method which set in the config.
|
5
8
|
if MailEngine::Base.current_config["access_check_method"].present?
|
6
9
|
before_filter MailEngine::Base.current_config["access_check_method"]
|
7
10
|
end
|
8
11
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
+
###
|
13
|
+
# return js o close fancy box and refresh page.
|
12
14
|
def close_modal_and_refresh
|
13
15
|
render :text => "<script>parent.$.fancybox.close();parent.window.location.reload();</script>"
|
14
16
|
end
|
@@ -2,6 +2,7 @@ class MailEngine::DashboardController < MailEngine::ApplicationController
|
|
2
2
|
def index
|
3
3
|
@pie_chart_columns = ["bounces", "unique_opens", "spamreports", "blocks", "unopened"]
|
4
4
|
@data_of_today = MailEngine::Sendgrid::RestApi.stats
|
5
|
+
# unopened data needs you calculate by yourself.
|
5
6
|
@data_of_today.merge!("unopened" => (@data_of_today["delivered"].to_i - @data_of_today["unique_opens"].to_i))
|
6
7
|
end
|
7
8
|
end
|
@@ -8,6 +8,9 @@ class MailEngine::MailSchedulesController < MailEngine::ApplicationController
|
|
8
8
|
def show
|
9
9
|
end
|
10
10
|
|
11
|
+
def edit
|
12
|
+
end
|
13
|
+
|
11
14
|
def destroy
|
12
15
|
@mail_schedule.destroy
|
13
16
|
redirect_to mail_schedules_path
|
@@ -39,9 +42,6 @@ class MailEngine::MailSchedulesController < MailEngine::ApplicationController
|
|
39
42
|
end
|
40
43
|
end
|
41
44
|
|
42
|
-
def edit
|
43
|
-
end
|
44
|
-
|
45
45
|
def send_test_mail
|
46
46
|
@mail_schedule.send_test_mail_to!(params[:recipient], params[:sample_user_id])
|
47
47
|
render :text => %Q{alert("Test Mail sent to #{params[:recipient]}"); $('#recipient').val('');}
|
@@ -5,6 +5,12 @@ class MailEngine::MailTemplateFilesController < MailEngine::ApplicationControlle
|
|
5
5
|
def index
|
6
6
|
end
|
7
7
|
|
8
|
+
def edit
|
9
|
+
end
|
10
|
+
|
11
|
+
def show
|
12
|
+
end
|
13
|
+
|
8
14
|
def new
|
9
15
|
@mail_template_file = @mail_template.mail_template_files.new
|
10
16
|
end
|
@@ -18,9 +24,6 @@ class MailEngine::MailTemplateFilesController < MailEngine::ApplicationControlle
|
|
18
24
|
end
|
19
25
|
end
|
20
26
|
|
21
|
-
def edit
|
22
|
-
end
|
23
|
-
|
24
27
|
def update
|
25
28
|
if @mail_template_file.update_attributes(params[:mail_engine_mail_template_file])
|
26
29
|
close_modal_and_refresh
|
@@ -34,9 +37,6 @@ class MailEngine::MailTemplateFilesController < MailEngine::ApplicationControlle
|
|
34
37
|
render :text => "window.location.reload()"
|
35
38
|
end
|
36
39
|
|
37
|
-
def show
|
38
|
-
end
|
39
|
-
|
40
40
|
private
|
41
41
|
|
42
42
|
def find_model
|
@@ -17,9 +17,6 @@ class MailEngine::MailTemplatesController < MailEngine::ApplicationController
|
|
17
17
|
@mail_templates = @mail_templates.group("path").page(params[:page]).per(20)
|
18
18
|
end
|
19
19
|
|
20
|
-
def show
|
21
|
-
end
|
22
|
-
|
23
20
|
def preview
|
24
21
|
@mail_template = MailEngine::MailTemplate.new if @mail_template.blank?
|
25
22
|
@mail_template.body = params[:new_body] if params[:new_body]
|
@@ -129,6 +126,9 @@ class MailEngine::MailTemplatesController < MailEngine::ApplicationController
|
|
129
126
|
end
|
130
127
|
end
|
131
128
|
|
129
|
+
def show
|
130
|
+
end
|
131
|
+
|
132
132
|
def edit
|
133
133
|
end
|
134
134
|
|
@@ -144,14 +144,8 @@ class MailEngine::MailTemplatesController < MailEngine::ApplicationController
|
|
144
144
|
render :import
|
145
145
|
end
|
146
146
|
|
147
|
-
# def send_test_mail
|
148
|
-
# @mail_template.send_test_mail_to!(params[:recipient])
|
149
|
-
# render :text => "alert('Test Mail sent to #{params[:recipient]}'); $('#recipient').val('');"
|
150
|
-
# rescue => e
|
151
|
-
# render :text => "alert(\"Test Mail failed to send to #{params[:recipient]}, due to #{e.to_s}\"); $('#recipient').val('');"
|
152
|
-
# end
|
153
|
-
|
154
147
|
private
|
148
|
+
|
155
149
|
def find_model
|
156
150
|
@mail_template = MailTemplate.find(params[:id]) if params[:id].present?
|
157
151
|
end
|
@@ -17,7 +17,6 @@ class MailEngine::ReportsController < MailEngine::ApplicationController
|
|
17
17
|
"unsubscribes",
|
18
18
|
"repeat_unsubscribes"
|
19
19
|
]
|
20
|
-
|
21
20
|
@stats_data = if params[:report] and params[:report][:from] and params[:report][:to]
|
22
21
|
MailEngine::Sendgrid::RestApi.stats(:start_date => params[:report][:from], :end_date => params[:report][:to])
|
23
22
|
else
|
@@ -1,8 +1,7 @@
|
|
1
1
|
class MailEngine::MailDispatcher < ActionMailer::Base
|
2
|
-
default :from =>
|
2
|
+
default :from => MailEngine::Base.current_config["default_from"]
|
3
3
|
sendgrid_header do
|
4
|
-
category MailEngine::Base.current_config["
|
5
|
-
|
4
|
+
category MailEngine::Base.current_config["sendgrid"]["category_name"]
|
6
5
|
filters {
|
7
6
|
opentrack "enable" => 1
|
8
7
|
clicktrack "enable" => 1
|
@@ -22,12 +21,11 @@ class MailEngine::MailDispatcher < ActionMailer::Base
|
|
22
21
|
# ).deliver
|
23
22
|
#
|
24
23
|
def self.method_missing(method, *args)
|
25
|
-
return super if respond_to?(method)
|
24
|
+
return super if respond_to?(method)
|
26
25
|
|
27
26
|
options = args.dup.extract_options!
|
28
27
|
options[:locale] ||= I18n.locale
|
29
28
|
|
30
|
-
# TODO if template file exists, don't need to exam the db.
|
31
29
|
templates = MailEngine::MailTemplate.where(:path => method, :locale => options[:locale], :for_marketing => true, :partial => false).order('format desc').all
|
32
30
|
raise "No Template added." if templates.blank?
|
33
31
|
|
@@ -28,8 +28,7 @@ module ActionMailer
|
|
28
28
|
# Why here but not add to default_params of action_mailer? because the receiver email [:to] only can get here.
|
29
29
|
if self.sendgrid_config
|
30
30
|
# if add "replacement_email" option in config
|
31
|
-
receiver = if replacement_email = MailEngine::Base.current_config["replacement_email"]
|
32
|
-
replacement_email
|
31
|
+
receiver = if (replacement_email = MailEngine::Base.current_config["replacement_email"]).present?
|
33
32
|
headers[:to] = replacement_email
|
34
33
|
else
|
35
34
|
headers[:to]
|
@@ -3,8 +3,10 @@ development:
|
|
3
3
|
user_class_name: "User"
|
4
4
|
mount_at: "/admin/mail_engine"
|
5
5
|
access_check_method: "logged_in?"
|
6
|
+
default_from: "your@email.address"
|
6
7
|
replacement_email: "dev@youdomain.com"
|
7
8
|
sendgrid:
|
9
|
+
category_name: "you category name"
|
8
10
|
sendgrid_user: "you send grid username"
|
9
11
|
sendgrid_key: "password"
|
10
12
|
sendgrid_category: "my sendgrid category"
|
@@ -15,7 +17,9 @@ test:
|
|
15
17
|
mount_at: "/admin/mail_engine"
|
16
18
|
access_check_method: "logged_in?"
|
17
19
|
replacement_email: "dev@youdomain.com"
|
20
|
+
default_from: "your@email.address"
|
18
21
|
sendgrid:
|
22
|
+
category_name: "you category name"
|
19
23
|
sendgrid_user: "you send grid username"
|
20
24
|
sendgrid_key: "password"
|
21
25
|
sendgrid_category: "my sendgrid category"
|
@@ -25,8 +29,9 @@ production:
|
|
25
29
|
user_class_name: "User"
|
26
30
|
mount_at: "/admin/mail_engine"
|
27
31
|
access_check_method: "logged_in?"
|
28
|
-
|
32
|
+
default_from: "your@email.address"
|
29
33
|
sendgrid:
|
34
|
+
category_name: "you category name"
|
30
35
|
sendgrid_user: "you send grid username"
|
31
36
|
sendgrid_key: "password"
|
32
37
|
sendgrid_category: "my sendgrid category"
|
data/mail_engine.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{mail_engine}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.9"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["michael he"]
|
12
|
-
s.date = %q{2011-03-
|
12
|
+
s.date = %q{2011-03-16}
|
13
13
|
s.description = %q{Rails system mail management solution.}
|
14
14
|
s.email = %q{hlxwell@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -1,8 +1,7 @@
|
|
1
1
|
class UserMailer < ActionMailer::Base
|
2
|
-
default :from =>
|
3
|
-
|
2
|
+
default :from => MailEngine::Base.current_config["default_from"]
|
4
3
|
sendgrid_header do
|
5
|
-
category "
|
4
|
+
category MailEngine::Base.current_config["sendgrid"]["category_name"]
|
6
5
|
|
7
6
|
filters {
|
8
7
|
opentrack "enable" => 1
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mail_engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 9
|
10
|
+
version: 0.1.9
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- michael he
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-03-
|
18
|
+
date: 2011-03-16 00:00:00 +08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|