diff options
Diffstat (limited to 'actionmailer/lib/action_mailer/base.rb')
-rw-r--r-- | actionmailer/lib/action_mailer/base.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index cc996790c8..8659489808 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -278,11 +278,13 @@ module ActionMailer if @parts.empty? templates = Dir.glob("#{template_path}/#{@template}.*") templates.each do |path| - type = (File.basename(path).split(".")[1..-2] || []).join("/") - next if type.empty? - @parts << Part.new(:content_type => type, + # TODO: don't hardcode rhtml|rxml + next unless md = /^([^\.]+)\.([^\.]+\.[^\+]+)\.(rhtml|rxml)$/.match(File.basename(path)) + template_name = "#{md.captures[0]}.#{md.captures[1]}" + content_type = md.captures[1].gsub('.', '/') + @parts << Part.new(:content_type => content_type, :disposition => "inline", :charset => charset, - :body => render_message(File.basename(path).split(".")[0..-2].join('.'), @body)) + :body => render_message(template_name, @body)) end unless @parts.empty? @content_type = "multipart/alternative" |