aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/lib/action_mailer
diff options
context:
space:
mode:
authorMQuy <sugiacupit@gmail.com>2016-11-30 21:54:44 +0800
committerMQuy <sugiacupit@gmail.com>2016-11-30 22:18:14 +0800
commitc4639b77378675f16c28660f43a23f2805ee6392 (patch)
tree3a6ceaec13a7f75340007b4aff9d9ecfc27ec5cc /actionmailer/lib/action_mailer
parent162e889f16ceb47978fe9bc81ac0b46672f05ff0 (diff)
downloadrails-c4639b77378675f16c28660f43a23f2805ee6392.tar.gz
rails-c4639b77378675f16c28660f43a23f2805ee6392.tar.bz2
rails-c4639b77378675f16c28660f43a23f2805ee6392.zip
allow context type when set body mail
Diffstat (limited to 'actionmailer/lib/action_mailer')
-rw-r--r--actionmailer/lib/action_mailer/base.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb
index 1f5738bbab..2cb5c5514d 100644
--- a/actionmailer/lib/action_mailer/base.rb
+++ b/actionmailer/lib/action_mailer/base.rb
@@ -900,15 +900,19 @@ module ActionMailer
yield(collector)
collector.responses
elsif headers[:body]
- [{
- body: headers.delete(:body),
- content_type: self.class.default[:content_type] || "text/plain"
- }]
+ collect_responses_from_text(headers)
else
collect_responses_from_templates(headers)
end
end
+ def collect_responses_from_text(headers)
+ [{
+ body: headers.delete(:body),
+ content_type: headers[:content_type] || self.class.default[:content_type] || "text/plain"
+ }]
+ end
+
def collect_responses_from_templates(headers)
templates_path = headers[:template_path] || self.class.mailer_name
templates_name = headers[:template_name] || action_name