diff --git a/app/models/mailer.rb b/app/models/mailer.rb index a2d9ddb..852fbf0 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -219,6 +219,21 @@ class Mailer < ActionMailer::Base body[:content_for_layout] = render(:file => method_name, :body => body) ActionView::Base.new(template_root, body, self).render(:file => "mailer/#{layout}", :use_full_path => true) end + + # for the case of plain text only + def body(*params) + value = super(*params) + if Setting.plain_only_mail? + templates = Dir.glob("#{template_path}/#{@template}.text.plain.{rhtml,erb}") + unless String === @body or templates.empty? + template = File.basename(templates.first) + @body[:content_for_layout] = render(:file => template, :body => @body) + @body = ActionView::Base.new(template_root, @body, self).render(:file => "mailer/layout.text.plain.rhtml", :use_full_path => true) + return @body + end + end + return value + end # Makes partial rendering work with Rails 1.2 (retro-compatibility) def self.controller_path diff --git a/app/views/settings/_notifications.rhtml b/app/views/settings/_notifications.rhtml index 3670146..6dda931 100644 --- a/app/views/settings/_notifications.rhtml +++ b/app/views/settings/_notifications.rhtml @@ -10,6 +10,12 @@ <%= hidden_field_tag 'settings[bcc_recipients]', 0 %>

+
+

+ <%= check_box_tag 'settings[plain_only_mail]', 1, Setting.plain_only_mail? %> + <%= hidden_field_tag 'settings[plain_only_mail]', 0 %>

+
+
<%=l(:text_select_mail_notifications)%> <% @notifiables.each do |notifiable| %>